Java practice question

Set-5 Java MCQ

Java MCQ Set-5 : Multiple Choice Questions in Java Set-5

1. Inheritance is way to a. Make general classes into more specific classes.b. Pass arguments to objects of classesc. Add features to existing classes without rewriting them.d. Improve data-hiding and encapsulation Answer : c) 2. Advantages of inheritance include a. providing class growthb. avoiding rewriting of codec. data abstractiond. simulation of real-world entities Answer : …

Java MCQ Set-5 : Multiple Choice Questions in Java Set-5 Read More »

Set-5 Java MCQ

Java MCQ Set-3 : Multiple Choice Questions in Java Set-3

1. Predict the output produced by the following code: int I =0;outer:while (true){I ++;inner :for(int j = 0; j<10; j++){I+ = j;continue inner r;break outer;}continue outer;}System.out.println(I); a. 0b. 1c. 2d. 5 Answer : b) 2. State the output of the following code: int a = 10, b=5;if(a>b){if(b>5)System.out.println(“b is”+ b);}elseSystem.out.println(“a is”+ a); a. 5b. 10c. No …

Java MCQ Set-3 : Multiple Choice Questions in Java Set-3 Read More »