
Java Programming Quiz 1
Authored by Vijaya Kumar DTT
Computers
University
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
18 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a constructor in Java?
To destroy an object
To initialize an object
To define a method
To create a static variable
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which keyword is used to create an instance of a class?
class
new
this
static
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a class have multiple constructors?
No, only one constructor is allowed
Yes, with different parameter lists
Yes, but only with the same parameters
Only if the class is static
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why are Strings immutable in Java?
To improve performance
To ensure security and thread safety
To allow modification of String objects
To reduce memory usage
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? String s1 = "Hello"; String s2 = "Hello"; System.out.println(s1 == s2);
false
true
Compilation error
Runtime error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which class is thread-safe for String manipulation?
String
StringBuilder
StringBuffer
None of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the this keyword refer to in Java?
The class itself
The current object
A static method
The parent class
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?