
Unit-1 Quiz2
Quiz
•
Education
•
University
•
Practice Problem
•
Medium
Ms STAFF
Used 2+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a static variable in Java?
A static variable is a variable that cannot be changed once initialized.
A static variable is a variable that is only accessible within the method it is declared.
A static variable is a method-level variable unique to each instance.
A static variable is a class-level variable shared among all instances of the class.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does a static variable differ from an instance variable?
A static variable is shared across all instances of a class, while an instance variable is unique to each instance.
A static variable can only be accessed within the class, while an instance variable can be accessed from outside the class.
A static variable is unique to each instance of a class, while an instance variable is shared across all instances.
A static variable is created every time an instance is created, while an instance variable is created only once.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a static variable be accessed without creating an object?
Static variables cannot be accessed from outside their class.
Yes, a static variable can be accessed without creating an object.
Static variables can only be accessed in the same class.
No, a static variable requires an object to be accessed.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What are the characteristics of a static method in Java?
Characteristics of a static method in Java include: belongs to the class, can be called without an instance, can access static variables/methods, cannot access instance variables/methods directly.
Can access both static and instance variables directly
Can only be called from an instance of the class
Belongs to an object rather than the class
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a static method access instance variables directly?
Yes, a static method can access instance variables directly.
No, a static method cannot access instance variables directly.
Static methods can access instance variables through an object reference.
Static methods can modify instance variables directly.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a static block in Java?
To initialize static variables or perform actions at class loading time.
To handle exceptions that occur during class loading.
To define methods that can be called without creating an instance of the class.
To create a new instance of a class when it is loaded.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main difference between String and StringBuffer in Java?
StringBuffer is faster than String for all operations.
String can be modified after creation while StringBuffer cannot.
String is used for character data while StringBuffer is used for numeric data.
The main difference is that String is immutable while StringBuffer is mutable.
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?
Similar Resources on Wayground
18 questions
Prueba Evaluativa 2.1
Quiz
•
University
20 questions
Introduction to Retail Management
Quiz
•
University
17 questions
BCS Network Security Quiz 5
Quiz
•
University - Professi...
15 questions
Unidad 2 - Probabilidad y Estadística
Quiz
•
University
13 questions
Preliminary 1 sesi 1
Quiz
•
University
15 questions
Test (Droit) BTS2 : L'encadrement du traitement des données
Quiz
•
University
10 questions
International Banking & Forex Management
Quiz
•
University
10 questions
Escales de mesurament
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
