Java Programming MCQ | Java mcq questions and answers | Java quiz | Java Multiple Choice Questions

preview_player
Показать описание
Part I. Multiple Choice Questions :
1. Which of the following represents the life-cycle of software development?

2. Defining a class so that the implementation of the data and methods of the class are not known to the
programmers who use the class is called:

3. Which of the following is an incorrect identifier?

4. In the following block of code, what is the value of theVar?
int theVar = // 2
/* /* 4 + 5 */
6 * 3
// - 2
;

5. Which of the following is the proper order of promotion?

6. In the following block of code, what is the value of thePhrase?
String S1 = "anabolic regzrding vaccination";
String S2 = "itate";
String S3 = "grad";

7. Which of the following is an illegal assignment expression?

8. What is the resulting value of the following Java expression?
double x = (4.0f + (3.0)/(int)1.5) * (3/(int)4.0);

9. Given the following class and usage thereof, which of the labeled lines are incorrect?
public class Exam1
{
private final int aQuandry;
public Exam1( int quandry )
{
I: aQuandry = quandry;
}
}
// ... In some other class, in some method:
II: Exam1 exam = new Exam1();
III: exam.aQuandry = 42;
IV: Exam1 = new Exam1( 99 );

10. What is printed by the code below?
public class Test
{
private static final int value = 5;
public static void main( String[] args )
{
int total, value = 4;
total = value + value;
total = total + someMethod( total );
}
public static int someMethod( int val )
{
return value;
}
}
Рекомендации по теме