1.In Java, elements of an array are automatically initialized to some default va
ID: 3909750 • Letter: 1
Question
1.In Java, elements of an array are automatically initialized to some default value.
What is the default value for the elements of an array of integers?
2.Variables are used to store data in a program. To declare a variable is to tell the compiler what type of data a variable can hold.
3.Consider the following piece of code:
int i;
for(i=0; i<10; i++){
/* some code that doesn't modify i */
}
System.out.println("i="+i); /* line A */
What is printed by the statement on line A?
e. i = 10
4. Aperson may vote if they are 18 or older and not a felon. Which of the following statements assigns the Boolean variable mayVote correctly?
mayVote = !((age >= 18) || isFelon);
5. What is a sentinel value?
6.Which of the following operators is NOT a relational operator?
a.'0'Explanation / Answer
1. b) 0 (primitive int is initalized with 0)
2. b) True
3. e) i = 10 (because last incremented value of i is 10)
4. b) mayVote = (age >= 18) && !isFelon;
5. a) A value in which the loop condition would be false
6. c) +=
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.