
Chapter 2 – Elementary concepts of Objects and Classes
Quiz by Preeti Diwan
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
Which of the following is a correct definition of a class?
Which keyword is used to create a new instance of a class?
What is the correct way to create an object called myObj of MyClass?
The data members are known as behaviours in the real world objects
Consider the following code and find the output public class Example{ public void eg(){ System.out.println(“This is my first page”); // System.out.println(“Hello world”); public static void main(String args []) { Example e = new Example(); e.eg(); } }
What is the correct way to create an object called myObj of MyClass?
For the class television the member function for the class is getDetails()
What is the output of the below java class?
class Fox{ int legs = 2;} class Testing2{ public static void main(String[] args) { Fox t1 = new Fox(); System.out.println("T1 before: " + t1.legs); t1.legs = 4; System.out.println("T1 After: " + t1.legs); }}
9. Choose the correct statements about choosing a name for a class in Java.
Creating an object from a class is also called ____.
How many maximum numbers of objects can be created from a single Class in Java?
________ access specifier is mostly used for encapsulation .
_______ is an identifiable entity with some characteristics and behaviour
What is a blueprint for creating objects in Object-Oriented Programming (OOP)?
Members of a class specified as _______________ are accessible only to methods of that class.
Which of the following is an incorrect statement about objects in object- oriented programming?
The ___________________ keyword is used to allocate space in the dynamic memory.
Which of the following is the correct way to declare an object of a class? Consider the class name ‘Car’.