LPU_Java_Unit 1_Lecture 4_MCQ_Basics
1. Which of the following is not a primitive data type?
Answer:
string
2. What is the correct syntax for declaring a variable in Java?
Answer:
3. What is the primary purpose of using the static
keyword with variables in Java?
Answer:
To create a shared variable that is associated with the class, not with instances.
4. What is the default value of a boolean data type in Java if it is not explicitly initialized?
Answer:
false
5. Which of the following data types is used to store single characters?
Answer:
char