What to create | Quiz |
Which subject | Computer science |
What age group | Year or Grade 11 |
What topic | Java - data types, compound assignment, method signature, class, object instantiation |
Question types | Close-ended |
Number of questions | 25 |
Number of answers | 4 |
Correct answers | Exactly 1 |
Show correct answers | |
Use images (descriptions) | |
Any other preferences |
Please read each question carefully and choose the correct answer from the options provided.
What is the default value of a boolean variable in Java?
Which of the following is NOT a valid data type in Java?
What does a compound assignment operator do in Java?
Which of the following is the correct method signature for a method that returns an integer and takes no parameters?
What is an object in Java?
Which keyword is used to create a class in Java?
What is the purpose of the 'this' keyword in Java?
What will be the output of the following code snippet: int a = 5; a += 3;
?
How do you instantiate an object of the class named 'Car'?
Which data type can store a single character in Java?
What keyword is used to define a method in a Java class?
*In Java, the compound assignment operator `=` is used for what purpose?**
If a variable is declared as String str;
, what is its default value?
What does the following method signature indicate: public void displayInfo()
?
Which of the following statements correctly follows the rules of object-oriented programming?
What is a class in Java?
Which of the following keywords indicates that a method can be overridden?
What will the following code print? System.out.println(10 + 20 + " Hello");
What is the result of int x = 10; x -= 3;
in Java?
What type of variable is declared with the static
keyword?
How can you describe an instance variable?
In Java, which data type would you use to represent a decimal number?
In the context of Java, what does encapsulation mean?
Which of the following is the correct way to declare an array of integers in Java?
What is the return type of a method declared as public int calculate()
?