GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Well-structured Std 12 Computer Textbook MCQ Answers and Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java can serve as a valuable review tool before computer exams.

GSEB Std 12 Computer Chapter 8 MCQ Classes and Objects in Java

Question 1.
………….. is the basic unit in Object Oriented Programming.
(A) Object
(B) Class
(C) (A) and (B) both
(D) Method
Answer:
(C) (A) and (B) both

Question 2.
What is there in a class ?
(A) Attribute
(B) Method
(C) (A) and (B) both
(D) (A) or (B)
Answer:
(C) (A) and (B) both

Question 3.
What is a class ?
(A) A small room
(B) Object name with different properties
(C) Object structure with common properties
(D) None of these
Answer:
(C) Object structure with common properties

Question 4.
What is the format to define a class ?
(A) class <class Name>
{
<variables>
<methods>
}

(B) class <classname>
{
<variables>
(methods)
}

(C) class <class Name>
{
<methods>
<variables>
}

(D) class <classname>
{
<variables>
<methods>
}
Answer:
(B) class <classname>
{
<variables>
(methods)
}

Question 5.
Attribute is defined by ……………. in a class.
(A) variable
(B) method
(C) behavior
(D) none of these
Answer:
(A) variable

Question 6.
What is the use of method in a class ?
(A) To get the attributes
(B) To modify the attributes
(C) (A) and (B) both
(D) For calculation
Answer:
(C) (A) and (B) both

Question 7.
Class is made of how many elements in a class ?
(A) 2
(B) 3
(C) 4
(D) 5
Answer:
(A) 2

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 8.
……………. element is included in class of Java.
(A) Attribute
(B) Behavior
(C) (A) or (B)
(D) Method
Answer:
(C) (A) or (B)

Question 9.
Behavior is defined by ……………. in a class.
(A) method
(B) program
(C) (A) and (B) both
(D) none of these
Answer:
(A) method

Question 10.
……………….. is the syntax to declare an object creation from a class.
(A) <class name> <variables name>
(B) (class name> cvariables name>
(C) <variables name) <classname>
(D) None of these
Answer:
(A) <class name> <variables name>

Question 11.
………… keyword allots the memory to the object while creating the object.
(A) obj
(B) new
(C) NEW
(D) (A) and (B) both
Answer:
(B) new

Question 12.
……………. is called to assign a value to newly created object.
(A) Conductor
(B) Constructor
(C) (A) or (B)
(D) None of these
Answer:
(B) Constructor

Question 13.
In Java, a class is of …………………. type same as a data type.
(A) int and boolean
(B) int and float
(C) boolean and float
(D) none of these
Answer:
(A) int and boolean

Question 14.
What is the use of name of class in Java ?
(A) To declare the type of a variable
(B) To define a type of formal parameter
(C) To define type of return values
(D) All of these
Answer:
(D) All of these

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 15.
Which statement in not true ?
(A) Any variable never stores the object in Java.
(B) The variable declared with class type only indicates the object
(C) The variable of class type is called reference variable
(D) Any variable value is stored in an object first
Answer:
(D) Any variable value is stored in an object first

Question 16.
Using ……………… keyword an object is created.
(A) create
(B) new
(C) NEW
(D) CREATE
Answer:
(B) new

Question 17.
What is heap ?
(A) Special word of Java
(B) Special part of memory
(C) Special subsidiary part of memory
(D) None of these
Answer:
(B) Special part of memory

Question 18.
What is kept in heap ?
(A) Object
(B) class Address
(C) classes
(D) All of these
Answer:
(A) Object

Question 19.
What is the use of constructor while creating an object ?
(A) To allot memory
(B) To initialize the newly created object
(C) (A) and (B) both
(D) None of these
Answer:
(C) (A) and (B) both

Question 20.
To declare an object of class ‘Room’ and make the reference variable r1 then ……………. would be the
correct statement.
(A) r1 = Room ();
(B) r1 = new Room ();
(C) Room () = r1;
(D) r1 – new room ();
Answer:
(B) r1 = new Room ();

Question 21.
If we done use the argument in the declared object, then what is called by the empty parentheses ?
(A) Predefined constructor
(B) Zero value
(C) This is not possible
(D) -1 value
Answer:
(A) Predefined constructor

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 22
In the statement “r1 = new Room ();”, what does r1 hold ?
(A) Object is stored in variable r1
(B) Variable r1 holds only the address of object
(C) Holds the value of Room()
(D) All of these
Answer:
(B) Variable r1 holds only the address of object

Question 23.
Data is actually stored where ?
(A) Within an object
(B) Within a class
(C) (A) and (B) both
(D) (A) or (B)
Answer:
(A) Within an object

Question 24.
What is the use of garbage collector ?
(A) Looks for unused objects
(B) Reclaims the memory that those objects are using
(C) (A) and (B) both
(D) To monitor the program properly
Answer:
(C) (A) and (B) both

Question 25.
In OOP, creating an object is called …………… .
(A) object installation
(B) object Instantiation
(C) object Creation
(D) object Preparation
Answer:
(B) object Instantiation

Question 26.
What is the other word used for object ?
(A) Instance of a class
(B) Data of class
(C) Variable
(D) Parameter
Answer:
(A) Instance of a class

Question 27.
……………… is the abstract representation of an object.
(A) Instance
(B) Class
(C) Parameter
(D) None of these
Answer:
(B) Class

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 28.
……………… is the concrete representation of an object.
(A) Instance
(B) Class
(C) Variable
(D) Parameter
Answer:
(A) Instance

Question 29.
In OOP, …………….. words are used interchangeably.
(A) Instance
(B) Object
(C) (A) and (B) both
(D) None of these
Answer:
(C) (A) and (B) both

Question 30.
Where is method created in Java ?
(A) In object
(B) In class
(C) In program
(D) Not possible
Answer:
(B) In class

Question 31.
What is the use of instance method ?
(A) To get the value of instance variable
(B) To change the value of instance variable
(C) To define the behavior of an object
(D) All of these
Answer:
(D) All of these

Question 32.
………….. is not the instance method.
(A) setAttr ( )
(B) display ( )
(C) width ( )
(D) area ( )
Answer:
(C) width ( )

Question 33.
…………… is not the instance variable.
(A) length
(B) nWindows
(C) width
(D) setAttr()
Answer:
(D) setAttr()

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 34.
…………….. operator is used to access instance variable.
(A) .
(B) ,
(C) #
(D) ;
Answer:
(A) .

Question 35.
Which is the syntax to access instance variable ?
(A) <object reference> ; <instance variable>
(B) <cobject reference> . <instance variable>
(C) <instance variable> . <cobject reference>
(D) <object reference> , <instance variable>
Answer:
(B) <cobject reference> . <instance variable>

Question 36.
What is the associativity of dot operator ?
(A) Left to right
(B) right to left
(C) Defining a value
(D) None of these
Answer:
(A) Left to right

Question 37.
When dot is not needed in instance variable ?
(A) When we use instance variable inside different methods of a class
(B) When we use instance variable in a method of same class
(C) In the simple Java program
(D) This is not possible
Answer:
(B) When we use instance variable in a method of same class

Question 38.
…………… variable can be accessed without creating the instance of a class.
(A) Static
(B) Object
(C) (A) and (B) both
(D) This is not possible
Answer:
(A) Static

Question 39.
In ………………. variable, beginning is not done with predefined values.
(A) Local
(B) Instance
(C) Class
(D) All of these
Answer:
(A) Local

Question 40.
In …………….. variable, predefined values are given.
(A) Local
(B) Instance
(C) Class
(D) (B) and (C) both
Answer:
(D) (B) and (C) both

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 41.
……………. variables are defined within methods or blocks.
(A) Instance
(B) Local
(C) Class
(D) (B) and (C) both
Answer:
(B) Local

Question 42.
…………….. variables are defined in a particular class but outside the method.
(A) Local
(B) Instance
(C) (A) and (B) both
(D) Class
Answer:
(B) Instance

Question 43.
…………….. variable are allotted the memory from heap.
(A) Local
(B) Class variable
(C) Instance
(D) (B) and (C) both
Answer:
(C) Instance

Question 44.
……………. variable is defined with static keyword in a class but outside the method.
(A) Local
(B) Class
(C) Instance
(D) (B) and (C) both
Answer:
(B) Class

Question 45.
…………. variable is assigned a value only once, but it can be used by all objects.
(A) Local
(B) Class
(C) Instance
(D) Special
Answer:
(B) Class

Question 46.
Which is the third object to create an object] ?
(A) Declaration
(B) Instantiation
(C) Initialization
(D) Comment
Answer:
(C) Initialization

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 47.
What is the meaning of polymorphism ?
(A) Many forms
(B) More than one form
(C) (A) and (B) both
(D) Infinite form
Answer:
(C) (A) and (B) both

Question 48.
Different methods with same name means …………….. .
(A) polymorphism
(B) constmctors
(C) accessor method
(D) inheritance
Answer:
(A) polymorphism

Question 49.
Different methods with same name but different signature mean ………….. .
(A) method overloading
(B) method writeloading
(C) (A) or (B)
(D) constmctors
Answer:
(A) method overloading

Question 50.
…………… is the special method which is invoked while creating an object.
(A) Inheritance
(B) Constmctors
(C) Public
(D) Mutator
Answer:
(B) Constmctors

Question 51.
………….. is mainly used to initialize the values.
(A) Constmctors
(B) Inheritance
(C) Composition
(D) All of these
Answer:
(A) Constmctors

Question 52.
………… is called constructor without variables.
(A) Inheritance
(B) Default Constmctors
(C) Mutator method
(D) All of these
Answer:
(B) Default Constmctors

Question 53.
Which statement is wrong about constructors ?
(A) Constructor name and class name are similar.
(B) Constmctors do not have return type.
(C) Constructors can be invoked from anywhere in the program
(D) When an object is created using a new operator then only it can be invoked by a constructor
Answer:
(C) Constructors can be invoked from anywhere in the program

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 54.
If we try to make an object with constructor and without variable then what will be the output ?
(A) 0
(B) 1
(C) Compiler shows the error
(D) – 1
Answer:
(C) Compiler shows the error

Question 55.
What is added in a program when user defined constructor is created without a variable ?
(A) New class is created
(B) <classname> ( ) { }:
(C) <classname> ( ) { };
(D) Constructor without variable is not possible
Answer:
(C) <classname> ( ) { };

Question 56.
Access modifier is called “visibility modifier” because of ……………. .
(A) access control is the visibility control
(B) access control can do modification
(C) access control is not the visibility control
(D) none of these
Answer:
(A) access control is the visibility control

Question 57.
How many visibility levels are there to make method or variable secured ?
(A) 2
(B) 3
(C) 4
(D) 5
Answer:
(C) 4

Question 58.
…………….. is the visibility level to make method or variable secured.
(A) Four P’s
(B) Four Q’s
(C) Four R’s
(D) This is not possible
Answer:
(A) Four P’s

Question 59.
………….. is not a visibility level of security.
(A) Public
(B) Protect
(C) Initial
(D) Private
Answer:
(C) Initial

Question 60.
Visibility level is declared in which part of the program ?
(A) Before the type of method or a variable
(B) After the type of method or a variable
(C) (A) or (B)
(D) None of these
Answer:
(A) Before the type of method or a variable

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 61.
……………… visibility is used to give appropriate form to different classes.
(A) Public
(B) Package
(C) Protected
(D) Private
Answer:
(B) Package

Question 62.
When the class is kept in default package ?
(A) When there is not package statement in a file
(B) When there is package statement in a file
(C) Any time it can be kept
(D) This is not possible
Answer:
(A) When there is not package statement in a file

Question 63.
……………. is the syntax of package statement.
(A) {Packagename};
(B) <packageName>;
(C) <packagename>
(D) (PackageName);
Answer:
(B) <packageName>;

Question 64.
If a method or variable is declared in the class and it is to be accessed by any outside class then ……………. to be declared as access modifier.
(A) public
(B) package
(C) protection
(D) private
Answer:
(A) public

Question 65.
………….. is the most possible access modifier.
(A) Package
(B) Protection
(C) Public
(D) Private
Answer:
(C) Public

Question 66.
…………… access modifier provides the visibility to the class defined in other package.
(A) Package
(B) Public
(C) Protection
(D) Private
Answer:
(B) Public

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 67.
If public access modifier is to be provided to each person then with ……………….. method key word public is used.
(A) main()
(B) start()
(C) open()
(D) none of these
Answer:
(A) main()

Question 68.
……………. is the second level access modifier.
(A) Public
(B) Package
(C) Protection
(D) Private
Answer:
(B) Package

Question 69.
………….. access modifier has not a specific name.
(A) Public
(B) Protection
(C) Package
(D) Private
Answer:
(C) Package

Question 70.
Range of …………… access modifier is less than public variable.
(A) package
(B) private
(C) (A) and (B) both
(D) protection
Answer:
(A) package

Question 71.
In ……………. access modifier , variable or method can be accessed from anywhere.
(A) package
(B) private
(C) public
(D) protection
Answer:
(A) package

Question 72.
………….. access modifier is used to access only the subclass or for the joint use of method which is declared as ’friend’.
(A) package
(B) private
(C) public
(D) protect
Answer:
(D) protect

Question 73.
Visibility of protected access modifier is less than ……………… .
(A) public
(B) package
(C) (A) and (B) both
(D) private
Answer:
(C) (A) and (B) both

Question 74.
Visibility of protected access modifier is more than ……………….. .
(A) public
(B) package
(C) (A) and (B) both
(D) private
Answer:
(D) private

Question 75.
……………… provides the highest level of protection.
(A) Public
(B) Private
(C) Package
(D) All of these
Answer:
(B) Private

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 76.
…………….. access modifier has the least visibility.
(A) Public
(B) Package
(C) Protect
(D) Private
Answer:
(B) Package

Question 77.
…………… access modifier has the general level protection.
(A) Private
(B) Protect
(C) Package
(D) All of these
Answer:
(A) Private

Question 78.
…………… access modifier has the feature of data encapsulation.
(A) package
(B) public
(C) private
(D) protect
Answer:
(C) private

Question 79.
…………. is the best way to provide data encapsulation.
(A) To make the data private as less as possible
(B) To make the data private as more as possible
(C) To make the data protected as more as possible
(D) To make the data protected as less as possible
Answer:
(B) To make the data private as more as possible

Question 80.
If no modifier is declared then ……………. is taken as the default modifier.
(A) package
(B) private
(C) public
(D) protected
Answer:
(A) package

Question 81.
When we declare the data private then what is our purpose ?
(A) To access the method of other class directly
(B) To make the method of other class protected by modifying it.
(C) (A) or (B)
(D) To save time
Answer:
(C) (A) or (B)

Question 82.
When accessor method is possible ?
(A) When we permit others to use the data
(B) When we modify the data and permit others
(C) (A) or (B)
(D) (A) and (B) both
Answer:
(A) When we permit others to use the data

Question 83.
When mutator method is possible ?
(A) When we permit others to use the data
(B) When we modify the data and permit others
(C) (A) or (B)
(D) (A) and (B) both
Answer:
(B) When we modify the data and permit others

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 84.
Accessor method is known as …………… .
(A) acceter
(B) setter
(C) getter
(D) mutator
Answer:
(C) getter

Question 85.
Mutator method is known as …………….. .
(A) acceter
(B) setter
(C) getter
(D) mutator
Answer:
(B) setter

Question 86.
What will be the accessor method for length.
(A) setLength
(B) length
(C) getLength()
(D) getlength()
Answer:
(C) getLength()

Question 87.
………………. method should be used if we want to permit other method to only read the data values.
(A) setter
(B) getter
(C) reader
(D) None of these
Answer:
(B) getter

Question 88.
What will be the mutator method for length ?
(A) setlength()
(B) setLength()
(C) getLength()
(D) getlength
Answer:
(B) setLength()

Question 89.
………………. will define the value of length attribute in setLength () method.
(A) void setLength() {length = /;}
(B) void setLength() {length = /:}
(C) void setLength (float 1) {length = /;}
(D) void setLength(float 1) clength = /;}
Answer:
(C) void setLength (float 1) {length = /;}

Question 90.
………… is the use of inheritance.
(A) To stop the existing the class and create a new class.
(B) To build a new class with added capabilities by expanding the existing class
(C) To use the characteristics existing class again
(D) (B) and (C) both
Answer:
(D) (B) and (C) both

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 91.
Inheritance is the model of …………….. type relationship.
(A) is-a
(B) has-a
(C) have-a
(D) none of these
Answer:
(A) is-a

Question 92.
All common features are kept in …………… class.
(A) super class
(B) sub class
(C) main class
(D) it can be kept anywhere.
Answer:
(A) super class

Question 93.
……………… inherits all instance variables and methods from super class and it may have its own added variables and methods.
(A) Sub class
(B) Super class
(C) Main class
(D) Subsidiary
Answer:
(A) Sub class

Question 94.
…………….. keyword is used to make a subclass in Java.
(A) create
(B) extends
(C) prepare
(D) None of these
Answer:
(B) extends

Question 95.
To call the constructor of super class ……………. keyword is used in the constructor of subclass.
(A) extends
(B) call
(C) super
(D) subs
Answer:
(C) super

Question 96.
…………….. method is used to display the attributes of object.
(A) display()
(B) show()
(C) print()
(D) None of these
Answer:
(B) show()

Question 97.
If there is method with common signature in super class and subclass then ………………….. method is
ignored in the subclass.
(A) display()
(B) super class
(C) sub class
(D) inheritance
Answer:
(B) super class

GSEB Std 12 Computer MCQ Answers Ch 8 Classes and Objects in Java

Question 98.
To invoke the display() method of super class ……………. to be used in the show() method.
(A) show.display()
(B) super.display()
(C) super:display()
(D) extend.display()
Answer:
(B) super.display()

Question 99.
……………. type of relationship between two classes is created in composition and aggregation.
(A) has-a
(B) have-a
(C) is-a
(D) None of these
Answer:
(A) has-a

Question 100.
…………… class creates has-a type relationship.
(A) Composition
(B) Aggregation
(C) (A) and (B) both
(D) Inheritance
Answer:
(C) (A) and (B) both

Question 101.
The class which includes the objects of other class is known as …………… .
(A) super class
(B) sub class
(C) container class
(D) subsidiary
Answer:
(C) container class

Leave a Comment

Your email address will not be published. Required fields are marked *