Data Types and Variables

Quiz Guidelines

 

Multiple Choice Question

QID: 
88

Which line(s) of code in the following program will cause a compilation error?

public class TestClass{
static int value = 0; //1
public static void main(String args[]) //2
{
int 2ndArgument = Integer.parseInt(args[2]); //3
if( true == 2 > 10 ) //4
{
value = -10;
}
else{
value = 2ndArgument;
}
for( ; value>0; value--) System.out.println("A"); //5
}
}

Select 1 option

A. 1
B. 2
C. 3
D. 4
E. 5

Multiple Choice Question

QID: 
87

Which of the following are valid declarations within a class?

Select 2 options

A. volatile int k;
B. abstract boolean bool;
C. native float radix;
D. friendly int ArrayList;
E. int friendly, ArrayList;

Multiple Choice Question

QID: 
86

Which of the following declaration are valid:

1. bool b = null;
2. boolean b = 1;
3. boolean b = true|false;
4 bool b = (10<11);
5. boolean b = true||false;

Select 1 option

A. 1 and 4
B. 2, 3, and 5
C. 2 and 3
D. 3 and 5
E. 5

Pages