Program Coding


Available Answers

  1. 1.

    Fill in the blanks.

    1. A program is a set of ______________ given to the computer to perform a task and give a ___________________.
    2. An ________________ translates and finds the error one line at a time.
    3. When an integer input is expected, but the user provides a name (string), this type of error is ______________________ error.
    4. The name of variables should be _____________________.
    5. Smallest value for an int data type is _______________ and the largest is _____________.
  2. 2.

    State whether the following statements are True (T) or False (F).

    1. Character literals are enclosed within double quotes.
    2. The % operator gives the remainder.
    3. The name given to a memory location is called a variable.
    4. Double is a data type that stores only integers.
    5. In an 'if-else' block, the 'if' statment is optional.
  3. 3.

    Find the errors in the following statements and re-write it making necessary corrections.

    1. int a;b;c;
    2. int a, float b;
    3. int a=12.3;
    4. float a=12.69;
  4. 4.

    State whether the following variable names are valid/invalid. If invalid, rectify it.

    1. name1
    2. float
    3. c.p.
    4. A>B
  5. 5.

    Write statements in Java for the following:

    1. Declare a variable a and b of integer type.
    2. Declare an integer variable x and initialize it with 73.
    3. Assign the sum of the variable m and n into the variable q.
    4. Check whether the value in variable a is greater than or equal to the value in variable b.
    5. Divide x with y and store the remainder in x.
  6. 6.

    Which among the following is a float literal and double literal?

    1. 12.35f
    2. 12.35
19 more answer(s) available.

Comments
Please display the answers
14 Feb 2023Jasmin T.
Please login to post your comments.