Java - Language Fundamentals Questions and Answers
Practice ModeShowing 10 of 39 questions
Q1
Which four options describe the correct default values for array elements of the types indicated?
int -> 0
String -> "null"
Dog -> null
char -> '\u0000'
float -> 0.0f
boolean -> true
Answer: Option B
Q2
Which one of these lists contains only Java programming language keywords?
Answer: Option B
Q3
Which will legally declare, construct, and initialize an array?
Answer: Option D
Q4
Which is a reserved word in the Java programming language?
Answer: Option B
Q5
Which is a valid keyword in java?
Answer: Option A
Q6
Which three are legal array declarations?
int [] myScores [];
char [] myChars;
int [6] myScores;
Dog myDogs [];
Dog myDogs [7];
Answer: Option A
Q7
public interface Foo
{
int k = 4; /* Line 3 */
}
Which three piece of codes are equivalent to line 3?
final int k = 4;
public int k = 4;
static int k = 4;
abstract int k = 4;
volatile int k = 4;
protected int k = 4;
Answer: Option A
Q8
Which one of the following will declare an array and initialize it with five numbers?
Answer: Option B
Q9
Which three are valid declarations of a char?
char c1 = 064770;
char c2 = 'face';
char c3 = 0xbeef;
char c4 = \u0022;
char c5 = '\iface';
char c6 = '\uface';
Answer: Option B
Q10
Which is the valid declarations within an interface definition?
Answer: Option A