Assessment (45 Questions And Answers) 2025-2026
Latest Updates
1. Which of the following is the correct way to declare and initialize a variable in Java?
A. int number = 10;
B. num int = 10;
C. integer number = 10;
D. var int = 10;
2. Which of the following is NOT a valid Java identifier?
A. age2
B. _count
C. 2ndValue
D. $money
3. What is the default value of an instance variable of type Boolean?
A. true
B. false
C. 0
D. null
4. Which of the following data types has the largest range?
A. int
B. short
C. long
D. byte
5. Which operator is used for string concatenation in Java?
A. &
B. +
, C. ++
D. concat
Operators & Control Flow
6. What is the output of:
int x = 5;
System.out.println(x++);
A. 6
B. 5
C. x
D. Compiler error
7. What will the following code print?
int a = 7;
int b = 2;
System.out.println(a / b);
A. 3.5
B. 3
C. 3.0
D. 4
8. Which loop guarantees that the body executes at least once?
A. for
B. while