
Unit-1 Quiz2

Quiz
•
Education
•
University
•
Medium
Ms STAFF
Used 2+ times
FREE Resource
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.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Posttest Modul 2 Bahasa Inggris Niaga

Quiz
•
University
20 questions
CS8592-OOAD-UNIT II- QUIZ III

Quiz
•
University
11 questions
Python - Class

Quiz
•
12th Grade - University
11 questions
Python - Data Types

Quiz
•
12th Grade - University
10 questions
PHP BASIC

Quiz
•
University
15 questions
Sensors and Transducers

Quiz
•
University
10 questions
Module 1- Python Basics_2nd_Semester

Quiz
•
University
20 questions
REVISION 3 : TOPIC 3, 4, 5 & 7

Quiz
•
1st Grade - University
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
10 questions
Afterschool Activities & Sports

Quiz
•
6th - 8th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
15 questions
Cool Tool:Chromebook

Quiz
•
6th - 8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
20 questions
Bullying

Quiz
•
7th Grade
18 questions
7SS - 30a - Budgeting

Quiz
•
6th - 8th Grade