Java Programming Questions & Answers: part11



Software Programming : Java Programming QUESTIONS AND ANSWERS :: part11 : 1 to 5

Following Software Programming language Entrance Multiple choice objective type questions and answers will help you in Software Programming 2024 examinations :

1.Use the following declarations and initializations to evaluate the Java expressions: (Please note that each expression has been tested separately.) int i=3, j=7, k=11; ++k –i +i + i++

16
17
14
13
15.

2.Which of the following assignment statement(s) is/are correct? I. char c = 'd'; II. char c = 100; III. char c = "d"; IV. char c = "100";

Only (I) above
Only (II) above
Both (I) and (II) above
Both (II) and (III) above
Both (III) and (IV) above.

3.Use the following declarations and initializations to evaluate the Java expressions: (Please note that each expression has been tested separately.) int i=3, j=7, k=11; #7) j + k % i

9
0
7
12
10.

4.Consider the following variable declarations: int i;float j; boolean k; Which of the following is correct initialization?

i = 1; j = 1.0; k = true;
i = 1; j = 1.0f; k = true;
i = 1; j = 1.0f; k = “true”;
i = 1; j = 1.0; k = “true”;
i = 1; j = 1.0f; k = True;

5.Consider the following segment of a Java program: int x=1; switch(x) {case 0:System.out.println(x);break; case 1:System.out.println(x);break; case 2:System.out.println(x); default: System.out.println(x); } What will the output be when the above segment is executed as a program?

0
1
2
1 1
error

More Java Programming QUESTIONS AND ANSWERS available in next pages

    Health is the greatest gift, contentment is the greatest wealth -Buddha
The only place where success comes before work is in the dictionary.- Vidal Sassoon