☕ university Java bank 40 extra midterm style

Q1
Compiler executes line by line, interpreter whole program?
True
False
❌ False (opposite)
Q2
Logic errors easier than syntax errors?
True
False
❌ False — syntax caught by compiler.
Q3
String s="Java"; char c=s.charAt(5);
'a'
runtime error
⏺ Runtime exception (index out of bounds)
Q4
Java features? (multiple)
simple
WORA
Windows only
✅ simple, WORA (not windows-only)
Q5
Invalid identifiers?
123data
amount-
$amount
❌ 123data, amount- are invalid.
Q6
Java keywords?
switch
double
class
🔑 switch, double, class
Q7
int i=1; while(i<3){ i++; }
🖨️ prints 1 2 (no 3)
Q8
If x=3, from if/else?
z is 9
Q9
If x=1 from same code
y is 3
Q10
x=5; x>2 && x<10
true
Q11
"Java Code".indexOf("Code")
5
Q12
"Hello".charAt(2)
'l' (third char)