Computer Science - Programming with JAVA
Quiz-summary
0 of 281 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
Information
This is MCQs of Computer Science Subject.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 281 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
- Answered
- Review
-
Question 1 of 281
1. Question
Which of the following is not a primitive data type?
Correct
Incorrect
-
Question 2 of 281
2. Question
What is the output of the following program?
public class TestFirstApp {
public static void main (string [] args) {
System.out.println ( (1==1) ? (7 == 8) ? 5: 6 : 4) ;
}
}Correct
Incorrect
-
Question 3 of 281
3. Question
Consider the following program.
Public class TestFirst App {
public static void main (string [] args) {
int wer;
System.out.println (“The value of wer is : ” + wer) ;
}
}
Choose the correct statement(s).Correct
Incorrect
-
Question 4 of 281
4. Question
The statements
byte var = -9;
System. out. println (var);Correct
Incorrect
-
Question 5 of 281
5. Question
The finally block is executed
Correct
Incorrect
-
Question 6 of 281
6. Question
What is the output of this program?
Correct
Incorrect
-
Question 7 of 281
7. Question
What is the output if the last statement in this program is replaced by the following statement?
System.out.println (myobj.doit(myobj.doid(myobj.doit(myArr[2], 0) ,myobj.doit(myArr[1], 0) ,
) , 0
)
);
Correct
Incorrect
-
Question 8 of 281
8. Question
The operators ||, &&, *, !, if arranged in the ascending order of precedence, read
Correct
Incorrect
-
Question 9 of 281
9. Question
The statement
System.out.print ((double) 7/4);
printsCorrect
Incorrect
-
Question 10 of 281
10. Question
Which of the following control structures is the most appropriate to implement the logic outlined in this flowchart?
Correct
Incorrect
-
Question 11 of 281
11. Question
Which of the following statements correctly implement the logic outlined in this flowchart?
Correct
Incorrect
-
Question 12 of 281
12. Question
Which of the following statement correctly implement the logic outlined in this flowchart?
Correct
Incorrect
-
Question 13 of 281
13. Question
What is the environment variable that contains a list of directories where Java looks for classes referenced in a program?
Correct
Incorrect
-
Question 14 of 281
14. Question
Consider the statement
system.out.print (Math.round (Math.random ()) ) ;
This statement can printCorrect
Incorrect
-
Question 15 of 281
15. Question
is null an object ?
Correct
Incorrect
-
Question 16 of 281
16. Question
Which of the following methods is used to get the error message for the exception that was thrown?
Correct
Incorrect
-
Question 17 of 281
17. Question
What condition could go into the black box if the following for loop prints 123456?
int[] myArr = { 1, 2, 3, 4, 5, 6};
int m = myArr.length;
for (; _____ ; –m)
system.out.print(myArr[myArr.length-m]);Correct
Incorrect
-
Question 18 of 281
18. Question
What is the output of the following program?
public class TestFirstApp {
public static void magic (int x) {
system.out.print (x%10) ;
if ( (x/10) ! = 0)
magic (x/10) ;
system.out.print(x%10);
}
public static void main (string [] args) {
Test FirstApp. magic (2357) ;
}
}Correct
Incorrect
-
Question 19 of 281
19. Question
subclass is also called
Correct
Incorrect
-
Question 20 of 281
20. Question
Which of the following ways of declaring and initializing a 1-dimensional integer array a size three is/are syntactically correct?
Correct
Incorrect
-
Question 21 of 281
21. Question
What is the output of the following program?
public class TestFirst App {
public static void main (string [ ] args ) {
int a=1, b=13 ;
if ( (b<(a=a+a)) || (b<(a=a+a)) || (b<(a=a+a)) || (b<(a=a+a)) || (b<(a=a+a))) system.out.println (b-a); else system.out.println (b+a); } }Correct
Incorrect
-
Question 22 of 281
22. Question
The following program
public class TestFirstApp {
public static void main (string [] args) {
int m=3 ;
system.out.println (m++ + ++m);
}
}Correct
Incorrect
-
Question 23 of 281
23. Question
Which of the following statements will result in compilation error?
Correct
Incorrect
-
Question 24 of 281
24. Question
The statements
double whatIsthis = -1.0/0.0;
system.out.println(whatisThis) ;Correct
Incorrect
-
Question 25 of 281
25. Question
Math.ceil(x) has the same value as
Correct
Incorrect
-
Question 26 of 281
26. Question
Let m be a variable of datatype byte. The value of m<<4 is same as
Correct
Incorrect
-
Question 27 of 281
27. Question
The statements
string wer1 = new string(“Hi”);
string wer2 = new string(“Hi”);
if (wer1 == wer2)
system.out.println(“This is not the answer”);
else
system.out.println?(“This is the answer”);Correct
Incorrect
-
Question 28 of 281
28. Question
What does the following program output?
public class TestFirstApp {
public static void main (string [] args) {
int count = 0
for (int var = 0;
for (int var = 0; var < 1000; var = var + 1) { if (var % 3 == 1) { count++; var = var+3; } } system.out.print(count); } }Correct
Incorrect
-
Question 29 of 281
29. Question
Which of the following operators take(s) only integer operands?
Correct
Incorrect
-
Question 30 of 281
30. Question
How many #’s do the following statements print?
for (int m=0, n=10; n-m > 5 ; ++m, –n)
system.out.print (“#”) ;Correct
Incorrect
-
Question 31 of 281
31. Question
Exceptions that are expected to possibly occur are called
Correct
Incorrect
-
Question 32 of 281
32. Question
Which of the following options correctly implement this grading logic?
(Assume marks is an integer between 0 to 100, both inclusive,)Correct
Incorrect
-
Question 33 of 281
33. Question
Which of the following options correctly implement this grading logic?
(Assume marks is an integer between 0 to 100, both inclusive.)Correct
Incorrect
-
Question 34 of 281
34. Question
The following statements
String wer = “12\u3456\u78910”;
System.out.println(wer.length.length() );Correct
Incorrect
-
Question 35 of 281
35. Question
Which of the following calls find the maximum of three gives integers a,b and c?
Correct
Incorrect
-
Question 36 of 281
36. Question
Garbage collector frees the programmer from worrying about.
Correct
Incorrect
-
Question 37 of 281
37. Question
What is the output of this program?
Correct
Incorrect
-
Question 38 of 281
38. Question
Replace Statement A, by the statement, new second () ;
Choose the correct statement(s).Correct
Incorrect
-
Question 39 of 281
39. Question
Replace Statement A, by the statement ,new third () ;
Choose the correct statement(s).Correct
Incorrect
-
Question 40 of 281
40. Question
Which of the class definitions has/have initialization block?
Correct
Incorrect
-
Question 41 of 281
41. Question
The keywords – try, catch, and finally, are typically used in the sequence
Correct
Incorrect
-
Question 42 of 281
42. Question
What does the following program output?
public class TestFirstApp {
public int i ;
public TestFirst App () {
System.out.pirnt (“**” + i + “**”) ;
i = 6;} system.out.print (“**” + i + “**”) ; i=10; ]
public static void main (string [] args {
TestFirst App myobj = new TestFirstApp () ;
System.out.print(“**” + myobj. i + “**”) ;
}Correct
Incorrect
-
Question 43 of 281
43. Question
What expression should go into the black box for the method call to be syntactically correct?
public class TestFirstApp {
public int doit (int [] i) {
return i[1] ;
}
public sta’ic void main (string[] args) {
TestFirstApp myObj = new TestFirst App ( );
System.out.print (myObj.doit (_____ ; ) ;
}
}Correct
Incorrect
-
Question 44 of 281
44. Question
Automatic conversion from primitive type to an object of the corresponding wrapper class is called
Correct
Incorrect
-
Question 45 of 281
45. Question
Consider the condition.
(m>5) || n!=m)
How will you rewrite this condition if java doesn’t have the || operator?Correct
Incorrect
-
Question 46 of 281
46. Question
The fact that any program can print using System.out.print, implies that
Correct
Incorrect
-
Question 47 of 281
47. Question
Which of the following are valid identifiers?
Correct
Incorrect
-
Question 48 of 281
48. Question
The program fragment
int x= 1, m=o;
for ( ; m<10 ; ++m)
x = x+x;
System.out.print (x) ;
printsCorrect
Incorrect
-
Question 49 of 281
49. Question
Elements of an array have the same
Correct
Incorrect
-
Question 50 of 281
50. Question
What does the following program output?
public class TestFirstApp {
void doIt ( ) {
System.out.print main (string [] args) {
TestFirstApp wer = new TestFirstApp () ;
wer.doIt ();
}
}Correct
Incorrect
-
Question 51 of 281
51. Question
Which of the following declaration is/are correct?
Correct
Incorrect
-
Question 52 of 281
52. Question
The following program
public class TestFirstApp {
public static void main (string [] args) {
int [] [] wer = new int [] [] {{1, 5}, {6, 8}};
System.out.println(wer[1] [1] ;
}
}Correct
Incorrect
-
Question 53 of 281
53. Question
Which of the following doesn’t have a superclass?
Correct
Incorrect
-
Question 54 of 281
54. Question
What is the output of the following program?
public class TestFirstApp {
public static void main (string [] args) {
int a=1, b=2, c=3 ;
a = b = c = 3 ;
System.out.println(1) ;
}
}Correct
Incorrect
-
Question 55 of 281
55. Question
Which of the following are widely accepted naming conventions in Java?
Correct
Incorrect
-
Question 56 of 281
56. Question
What is the output of the following program?
public class TestFirstApp {
public static void main (string [] args) {
boolean a=false;
if (! a&&a)
System.out.println(4);
else
System.out.println(5);
}
}Correct
Incorrect
-
Question 57 of 281
57. Question
The following program
public class TestFirstApp {
public static void main (string [] args {
byte a = (byte) 128;
System.out.println(a);
}Correct
Incorrect
-
Question 58 of 281
58. Question
A class variable is a variable that is declared inside a class as
Correct
Incorrect
-
Question 59 of 281
59. Question
The statements
double whatIsThis = -1.0/Double.POSITIVE_INFINITY;
System.out.println(whatIsThis) ;Correct
Incorrect
-
Question 60 of 281
60. Question
Which of the following three statements results in compilation error?
int m1 = (short) 2.3; // Statement 1
short m2 = (int) 2.3; // Statement 2
byte m3 = (int) 2.3; // Statement 3Correct
Incorrect
-
Question 61 of 281
61. Question
Constants that cannot be changed are declared using the keyword
Correct
Incorrect
-
Question 62 of 281
62. Question
The statement
System.out.println(Math.ceil(12.3) – Meth.floor(3.9));Correct
Incorrect
-
Question 63 of 281
63. Question
The statements
byte var = ~34;
System.out.println(var);Correct
Incorrect
-
Question 64 of 281
64. Question
It is typical to start a method name with
Correct
Incorrect
-
Question 65 of 281
65. Question
What does the following program output?
public class TestFirstApp {
public static void main (string[] args) {
int count = 0;
for (int var = 0 ; var < 1000; var = var _+ 1) { if (var % 3 == 1) count++; var + var+3; } System.out.print(count); } }Correct
Incorrect
-
Question 66 of 281
66. Question
What is the output of the following program?
public class TestTirstApp {
public static void main (string [] args) {
int a=1, b=13;
if ( (b<(a=a+a))|| (b<(a=a+a)) || (b<(a=a+a)) || (b<(a=a+a)) || (b<(a=a+a)) System.out.println(b-a); else System.out.println(b+a); } }Correct
Incorrect
-
Question 67 of 281
67. Question
What is the output of the following program?
public class TestTirstApp {
public static void main (string [] args) {
lebell : for (int i=0l i<5; ++i)
label2 : for (int j=0; j<3; ++j) {
if (j<=i) { System.out.print (j) ; continue labell ; } else break label2; } } }Correct
Incorrect
-
Question 68 of 281
68. Question
The Java language is
Correct
Incorrect
-
Question 69 of 281
69. Question
What is the output of this program?
Correct
Incorrect
-
Question 70 of 281
70. Question
What will be the output of this program if Statement A, is replaced by the statement
Correct
Incorrect
-
Question 71 of 281
71. Question
Which of the following comments about this program is/are correct?
(Assume there is no exception raised and remember that indexing starts at 0.)Correct
Incorrect
-
Question 72 of 281
72. Question
Which of the following is/are assumption(s) made by this program?
Correct
Incorrect
-
Question 73 of 281
73. Question
What will be the output of this program if Statement A, is replaced by the statement
System.out.println (doThis(0, 8, 200)) ;Correct
Incorrect
-
Question 74 of 281
74. Question
What will be the output of the program if Statement A. is replaced by the statement
System.out.println(doThis(2, 6, 2)) ;Correct
Incorrect
-
Question 75 of 281
75. Question
The number of bytes needed to store a number of datatype double is
Correct
Incorrect
-
Question 76 of 281
76. Question
The following program
public class TestFirstApp {public static void main (string [] args) {
int wer = 0123;
System.out.println(wer) ;
}
}
ourputsCorrect
Incorrect
-
Question 77 of 281
77. Question
Which of the following can be used to copy data from one array to another?
Correct
Incorrect
-
Question 78 of 281
78. Question
Which of the following operators don’t always evaluate all their operands?
Correct
Incorrect
-
Question 79 of 281
79. Question
Let Root be a class. Let Branch be a subclass of Root. Let this Branch be a Branch object. The condition – this Branch instanceof Root,
Correct
Incorrect
-
Question 80 of 281
80. Question
What do the following statements print?
int m = 1;
for (; m < 20 ; m ++) System.out.print(m*=1+m) ;Correct
Incorrect
-
Question 81 of 281
81. Question
What is the output if the value of m is 3?
Correct
Incorrect
-
Question 82 of 281
82. Question
What is the output if the value of m is 33?
Correct
Incorrect
-
Question 83 of 281
83. Question
Which of the following parameter passing mode(s) is/are supported by Java?
Correct
Incorrect
-
Question 84 of 281
84. Question
To find the maximum of two given integers a and b, Student A used the expression, a>b ? a : b. Student B used the call Meth.max(a,b). One of these two students got special recognition from the professor. Who is it?
Correct
Incorrect
-
Question 85 of 281
85. Question
The expression, Math.max(m,n), is same as the expression
Correct
Incorrect
-
Question 86 of 281
86. Question
Which of the following option correctly implement(s) the above flowchart?
Correct
Incorrect
-
Question 87 of 281
87. Question
Which of the following activities has the potential to throw a checked Exception?
Correct
Incorrect
-
Question 88 of 281
88. Question
A method is not working as expected.As part of the debugging process. I wan to check if a specific condition is met at a particular point, irrespective of how the execution reached that point. What language feature should I use?
Correct
Incorrect
-
Question 89 of 281
89. Question
To promote encapsulation, java provides an access modifier of type
Correct
Incorrect
-
Question 90 of 281
90. Question
Which of the following is/are NOT output by the following program?
public class TestFirstApp {
public boolean i;
public TestFirstApp () {
if (i == true) System.out.print(“Sunday”) ;
else System.out.print (“Monday”) ;
i – false;
}
{
if (i == true) System.out.print (“Tuesday”);
else System.out.print (“Wednesday”);
i = true;
}
public static void main (string [] args) {
TestFirstApp myObj = new TestFirstApp ();
if (myObj.i == true) System.out.print (“Thursday”);
else System.out.print (“Friday”);
}
}Correct
Incorrect
-
Question 91 of 281
91. Question
What is the output of this program if the body of the for loop is this statement
d = d+1;Correct
Incorrect
-
Question 92 of 281
92. Question
What is the output of this program if the body of the for loop is the if/else statement?
if ((a%3) == 0)
d = d-1;
else
d = d+1;Correct
Incorrect
-
Question 93 of 281
93. Question
What is the output of this program if the body of the for loop is the if satement
if ( ((a%2) ==0) && ((b%3) == 0) || ((c%4) == 0) )
d = d+1;Correct
Incorrect
-
Question 94 of 281
94. Question
What is the output of this program if the body of the for loop is the if satement
if ( ((a+b+c)%3) == 0 )
d = d+1;Correct
Incorrect
-
Question 95 of 281
95. Question
What is the output of this program if the body of the for loop is the if satement
if ( ((a%2) !=0) || ((b%3) != 0) || ((c%4) != 0) )
d = d+1;Correct
Incorrect
-
Question 96 of 281
96. Question
How much of storage does a character (represented in Unicode) need?
Correct
Incorrect
-
Question 97 of 281
97. Question
Which of the following calls find the minimum of three given integers, a, b, and c?
Correct
Incorrect
-
Question 98 of 281
98. Question
Consider the following program
public class TestFirstApp {
public boolean abc;
public static void main (string [] args) {
TestFirstApp myObj = new TestFirstApp() ;
System.out.println(myObj.abc);
}
}
What does this program output?Correct
Incorrect
-
Question 99 of 281
99. Question
Which of the following is/are syntactically correct?
Correct
Incorrect
-
Question 100 of 281
100. Question
Removal of which of these statement(s) will result in a compilation error?
Correct
Incorrect
-
Question 101 of 281
101. Question
The name of the file that contains this program
Correct
Incorrect
-
Question 102 of 281
102. Question
If this program is invoked from the command line as
java TestFirstApp Is Successful
Statement E will outputCorrect
Incorrect
-
Question 103 of 281
103. Question
Which of these classes does NOT have a superclass?
Correct
Incorrect
-
Question 104 of 281
104. Question
What is the output of the following program?
public class TestFirst App {
public static void main (string [] args) {
int a=12, b=7, c=3;
System.out.println(a%b%c);
}
}Correct
Incorrect
-
Question 105 of 281
105. Question
What statement(s) could go into the black box if this program prints 11?
Correct
Incorrect
-
Question 106 of 281
106. Question
Assume that the black box has the statement. i=11; What is the output if the statement
TestFirstApp myObj = new TestFirstApp () ;
is replaced by the statement
TestFirstApp myObj = new TestFirstApp (2, 3) ;Correct
Incorrect
-
Question 107 of 281
107. Question
Which of the following access specifiers is usually used with inheritance?
Correct
Incorrect
-
Question 108 of 281
108. Question
The statements
byte var1 = -10, var2 = -22;
System.out.println (var1 & var2) ;Correct
Incorrect
-
Question 109 of 281
109. Question
What does the following program output?
public class TestFirstApp {public static void main (string[] args) {
int count = 0
for (int var = 0; var < 100; var = var + 1) { if (var % 3 == 1) var = var+3; count ++; } System.out.print(count) ; } }Correct
Incorrect
-
Question 110 of 281
110. Question
What is the output of this program?
Correct
Incorrect
-
Question 111 of 281
111. Question
What is the output if the call wer.doThis (13) in Statement j, is replaced by the call wer.doThis(7)?
Correct
Incorrect
-
Question 112 of 281
112. Question
This program is a student’s response to to the question:
“For a given array of integers and a given integer m, write a Java Program that counts and displays the largest number of m’s that appear together”
However, the student’s response doesn’t give the correct output for certain value (s) of m.
For which of the following values of m does the program give an incorrect output? (The student used the variable inp to refer to m,)Correct
Incorrect
-
Question 113 of 281
113. Question
Which one of the following statement needs to be changed so that the program gives the correct output for any valid input?
Correct
Incorrect
-
Question 114 of 281
114. Question
What is the output if the call wer. doThis (13) in Statement J, is replaced by the call wer, doThis(2, 9) ?
Correct
Incorrect
-
Question 115 of 281
115. Question
Which of the following statements are not necessary?
Correct
Incorrect
-
Question 116 of 281
116. Question
Which of the following statements are not necessary?
Correct
Incorrect
-
Question 117 of 281
117. Question
Which of the following operators act on only integer operands?
Correct
Incorrect
-
Question 118 of 281
118. Question
Consider the following program fragment.
if (a>b)
System.out.println(“Statement 1”);
else
System.out.println (“Statement 2”);
System.out.println (“Statement 3”);
Statement 3 will be printed ifCorrect
Incorrect
-
Question 119 of 281
119. Question
An interactive Program asks the question__”Are you right-handed, left-handed, or ambidextrous ? Type R if right-handed, L if Left-Handed, A if ambidextrous.”The part of the Program (written by student A) that does the appropriate action depending on the user’s response, is given below.
if (response == ‘A’) // condition 1
doThisForAmbidextrous( );
else if (response == ‘R’) // condition 2
doThisForRightHanded( );
else if (response == ‘L’) // condition 3
doThisForLeftHanded ( );
Student B did the same thing bu checked the condition in the order– condition 3,condition 2 and condition 1
Student C did the same thing bu checked the condition in the order– condition 2,condition 3 and condition 1
Student D did the same thing bu checked the condition in the order– condition 2,condition 1 and condition 3
One of these four students got special recognition form the professor for the order in Which the student checked the conditions. Who is that student?Correct
Incorrect
-
Question 120 of 281
120. Question
Consider the following statement
System.out.print (Math.round(Math.random()) );
This statement was executed 15 times. The first 14 execution printed 0,1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1. What did the 15th execution print?Correct
Incorrect
-
Question 121 of 281
121. Question
How many #’s does the following for loop output?
for(int m=0, n=100; n-m > 30; ++m, –n)
System.out.print (“#”);Correct
Incorrect
-
Question 122 of 281
122. Question
The expression
(int) Math.floor (m + 0.5)
is mathematically equivalent toCorrect
Incorrect
-
Question 123 of 281
123. Question
Which of the following will not appear in the output?
Correct
Incorrect
-
Question 124 of 281
124. Question
Choose the correct statement(s).
Correct
Incorrect
-
Question 125 of 281
125. Question
Which of the following code correctly implement(s) the following flowchart?
print one__False__m==n__False__x>y__False__a<=bCorrect
Incorrect
-
Question 126 of 281
126. Question
Which of the following keywords is used to declare exceptions that can possibly occur?
Correct
Incorrect
-
Question 127 of 281
127. Question
This program outputs
Correct
Incorrect
-
Question 128 of 281
128. Question
What will be the output if the condition in Statement A, is replaced by the condition, x%2 != 0?
Correct
Incorrect
-
Question 129 of 281
129. Question
Which of the following types of exceptions must be declared by a piece of code that has the potential to throw such a type of exception?
Correct
Incorrect
-
Question 130 of 281
130. Question
What does the following fragment do to the two-dimensional matrix x?
int [] [] x = { {1, 2, 3, 4}, {4, 3, 2, 1}, {6, 7, 8, 9}, {1, 3, 5, 7} };
for(int i=0 ; i<4 ; ++i)
for (int j=0 ; j<4 ; ++j)
x [i] [j] = x [j] [i];Correct
Incorrect
-
Question 131 of 281
131. Question
The finalize method is declared with the access specifier
Correct
Incorrect
-
Question 132 of 281
132. Question
Which of the following can be statement A?
Correct
Incorrect
-
Question 133 of 281
133. Question
Which of the following can be Statement B?
Correct
Incorrect
-
Question 134 of 281
134. Question
Which of the following number variables is/are not accessible in class Third?
Correct
Incorrect
-
Question 135 of 281
135. Question
Which of the following calls find the maximum of the three integer a,b,c?
Correct
Incorrect
-
Question 136 of 281
136. Question
Which of the following calls find the minimum of the three integers a, b, c?
Correct
Incorrect
-
Question 137 of 281
137. Question
Which of the following declaration of a local variable is invalid?
Correct
Incorrect
-
Question 138 of 281
138. Question
The following Program
public class TestFirstApp {
public static void main (string[] args) {
int wer = 0x123;
System.out.println(wer);
}
}
outputsCorrect
Incorrect
-
Question 139 of 281
139. Question
Which is true of constructors?
Correct
Incorrect
-
Question 140 of 281
140. Question
What is the output of the following program?
public class TestFirstApp {
public static void main (string [] args) {
System.out.println (( 1==2) ? )7==7) ? : 6 : 4):
}
}Correct
Incorrect
-
Question 141 of 281
141. Question
Choose the correct statement(s)
Correct
Incorrect
-
Question 142 of 281
142. Question
The statement
System.out.println(“This is what you see: ” + 1 + 2):Correct
Incorrect
-
Question 143 of 281
143. Question
The recursive function magic gets into an infinite loop if
Correct
Incorrect
-
Question 144 of 281
144. Question
The recursive function magic returns a negative integer if
Correct
Incorrect
-
Question 145 of 281
145. Question
Choose the correct statement(s).
If statement A isCorrect
Incorrect
-
Question 146 of 281
146. Question
Which of the following conclusions cannot be true if A extends B is syntactically correct in a program?
Correct
Incorrect
-
Question 147 of 281
147. Question
What does the following program fragment do to the two-dimensional matix x?
int [] [] x = { {1, 2, 3, 4}, {4, 3, 2, 1}, {6, 7, 8, 9}, {1, 3, 5, 7}, };
for (int i=0 ; i<4 ; ++i)
for (int j=0; j<4 ; ++1)
if (i==j)
x[i][j]= 1;
else
x[i][j] = 0;Correct
Incorrect
-
Question 148 of 281
148. Question
Which of the following packages needs to be imported to use the StringTokenizer class?
Correct
Incorrect
-
Question 149 of 281
149. Question
Which of the following represents the range of values that a variable of datatype byte can take?
Correct
Incorrect
-
Question 150 of 281
150. Question
What is the output of the following program?
public class TestFirstApp {
public static void main (string[] args) {
int a=1, b=2;
if ( (a==3)&& (b==(b=3)) )
;
else System.out.println(b);
}
}Correct
Incorrect
-
Question 151 of 281
151. Question
Which of the following are standard stream objects?
Correct
Incorrect
-
Question 152 of 281
152. Question
The statements
byte var1 = -51, var2 = -28;
System.out.println(var1 & var2) ;Correct
Incorrect
-
Question 153 of 281
153. Question
The following program
public class TestFirstApp {
public static void main (string[] args) {
int m=1;
if (m)
System.out.println(m);
}
}Correct
Incorrect
-
Question 154 of 281
154. Question
Which of the following control structures would you be using if the switch statement is not available in Java?
Assume each case ends with the break statement.Correct
Incorrect
-
Question 155 of 281
155. Question
The statements
int a = (int) 3.9;
System.out intln (a) ;Correct
Incorrect
-
Question 156 of 281
156. Question
The statements
int [ ] wer = {1, 5, 6}; //Statement 1
int m=1; // Statement 2
wer[m++]++; //statement 3
System.out.println(“” + wer[0] + wer[1] + wer[2]);Correct
Incorrect
-
Question 157 of 281
157. Question
Which of the following repository is used by the runtime system to identify the correct exception handler when an exception is thrown?
Correct
Incorrect
-
Question 158 of 281
158. Question
Consider the following incomplete program.
public class TestFirstApp {
public static void main (string[] args) {
for (int j = 1; j < 6; j++) { for (int k = 1; k _____ ; k++) System.out.print(j + " "); System.out.print() ; } } } What should go into the black box if the desired output is 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5Correct
Incorrect
-
Question 159 of 281
159. Question
Let a and b be two positive integers. Which of the following correctly relates a and b?
Correct
Incorrect
-
Question 160 of 281
160. Question
Which of the following methods neither takes any parameter nor returns anything?
Correct
Incorrect
-
Question 161 of 281
161. Question
What is the output of the following program?
public class TestFirstApp {
public void doIt (int m, int n) {
int k;
k=m;
m=n;
n=k;
System.out.print(m);
return;
}
public static void main(string[] args) {
int m=3, n=5;
TestFirstApp myObj = new TestFirstApp();
myObj.doIt(m,n);
System.out.print(m);
}
}