Home / HSC(ENG) - GSEB Board / Reading Mode

πŸ“– Reading Mode: HSC(ENG) - GSEB Board

Chapter: Classes and objects in Java β€’ Total: 321 MCQs

MCQ 1 Constructors

which Is a special kind of method that is invoked when a new object is created ?

A local
B instance
C constructors
D static
MCQ 2 Visibility modifiers for Access Control

Which of the following level of protection is used to allow the access only to subclasses or to share with friend methods?

A protected
B public
C package
D private
MCQ 3 Class variables and class methods

What is the name of variables of class type refferd to as?

A related
B dynamic
C refernce
D all of the above
MCQ 4 Class in Java

How many components are used to made up every class in java ?

A 1
B 2
C 3
D 4
MCQ 5 Accessor and Mutator Methods

What is the meaning of mutator?

A To allow such a data to be used by others.
B to allow such a data to be modified by others.
C (B) and (D) both
D It is all known as β€˜setter’
MCQ 6 Objects

Which of the following steps are required for creating an object from a class?

A Declaration, Instantiation,Initialization
B Declaration, Initialization, Instantiation
C Instantiation, Initialization, Declaration
D Initialization, Instantiation, Declaration
MCQ 7 Inheritance

Person -> Teachaer class

A Composition
B Aggregation
C Inheritance
D Polymorphism
MCQ 8 Visibility modifiers for Access Control

Which statement should be added as the first non-comment or non-blank link in source file of java Β ?

A Public
B Protected
C Private
D Package
MCQ 9 Classification of variables declared in a class

In java, which variables are defined with static keyboard ?

A Class
B Instance
C Local
D All of the above
MCQ 10 Inheritance

INHERITANCE IS GENERALLY REFERRED AS WHICH TYPE OF REALTIONSHIP BETWEEN TWO CLASSES.

A PARTIAL
B FULL
C EXCULSIVE
D IS A KIND OF
MCQ 11 Visibility modifiers for Access Control

IF WE WANT TO MAKE VISIBLE TO ALL THE CLASSES OUTSIDE THE CLASS, WHICH TYPE OF ACCESS MODIFIER IS USED.

A PROTECTED
B PACKAGE
C PUBLIC
D PRIVATE
MCQ 12 Methods

FROM THE FOLLOWING WHICH OPREATOR IS USED TO ACCESS INSTANCE VARIABLE AND INSTANCE IN JAVA.

A : (COLON)
B ; (SEMICON)
C . (DOT)
D , ( COMMA)
MCQ 13 Inheritance

IN OBJECT ORINTED TERMINOLOGY, THE EXISTING CLASS IS KNOWN AS WHAT

A SUPER CLASS
B PARENT CLASS
C SUB CLASS
D BOTH (A) & (B)
MCQ 14 'new' keyword

WHICH STEPS ARE REQUIRED TO CREATE OBJECT FROM A CLASS IN JAVA.

A DECLARATION
B INSTANTITATION
C INITIALIZATION
D ALL OF THESE
MCQ 15 Objects

IN OBJECT-ORIENTED PROGRAMMING (OOP) LANGUAGES, CREATING AN OBJECT IS ALSO KNOWN AS WHAT.

A OBJECT INSTANTITAON
B OBJECT CREATION
C OBJECT MAKING
D NONE OF THIS
MCQ 16 Visibility modifiers for Access Control

WHICH IS THE DEAFULT LEVEL OF PROTECTION, WHERE LACK OF ANY ACCESS MODIFIER KEYWORD IS IN A JAVA.

A PUBLIC
B PACKAGE
C PROTECTED
D PRIVATE
MCQ 17 Accessor and Mutator Methods

IN JAVA IF WE WANT TO ALLOW DATA DIRECTLY ACCESSED BY METHODS OF OTHER CLASS USED.

A GETTER
B SETTER
C MAIN
D VOID
MCQ 18 Visibility modifiers for Access Control

FROM THE FOLLOWING WHICH TYPE OF VISIBILITY MODIFIERS ARE USED TO PROTECT A METHOD OR VARIABLES?

A PUBLIC
B PACKAGE
C PROTECETED
D ALL OF THESE
MCQ 19 Class in Java

IN JAVA A CLASS IS DEFINED USING WHICH KEYWORD.

A CLASS
B PUBLIC
C STATIC
D MAIN
MCQ 20 Classification of variables declared in a class

WHICH TYPE OF VARIABLES ARE DEFINED INSIDE METHODS OR BLOCK.

A class variable
B global variable
C static variable
D local variable
MCQ 21 Inheritance

In class diagram, which of the following symbol is used to represent inheritance?

A Empty diamond symbol
B Fill diamond symbol
C Arrow diamond symbol
D Arrow symbol
MCQ 22 Introduction

Which of the following allows us to build new class with added capabilities by extending existing class ?

A Composition
B Inheritance
C Aggregation
D Polymorphism
MCQ 23 Introduction

In Object-oriented programming languages, creating an object is also called as what ?

A Object installation
B Object making
C Object creation
D Object instantiation
MCQ 24 Introduction

Which word means β€œmany forms”, different forms of methods with same name in Java ?

A Inheritance
B Polymorphism
C Composition
D Aggregation
MCQ 25 Introduction

Which of the following is a special kind of method that is invoked when a new object is created ?

A Class
B Instance
C Constructor
D Object
MCQ 26 Introduction

Which is the default level of protection, where lack of any access modifier keyword is in a declaration in Java ?

A Private
B Public
C Package
D Protected
MCQ 27 Introduction

In Java, which keyword is used to create the object by allocating memory ?

A super
B add
C new
D class
MCQ 28 Introduction

If we want to allow such data to be modified by others, then which method is used ?

A Mutor
B Accessor
C Mutator
D Access
MCQ 29 Introduction

In Java, a class is defined using which keyword ?

A class
B CLASS
C All of these
D Class
MCQ 30 Introduction

Which method is invoked automatically with creation of an object ?

A Object
B Instance
C Constructor
D Class
MCQ 31 Introduction

In Java, how many levels of visibility modifiers are available for access control ?

A 3
B 2
C 5
D 4
MCQ 32 Introduction

If we want to allow other methods to read only the data value, then which method is used ?

A writer
B reader
C getter
D setter
MCQ 33 Introduction

If we want to allow other methods to modify the data value, then which method is used ?

A getter
B write
C setter
D reader
MCQ 34 Introduction

In Java, who looks for unused objects and reclaims the memory ?

A Object collector
B Unused collector
C Garbage collector
D Reclaim collector
MCQ 35 Introduction

If we want to allow such data to be used by others, then which method is used ?

A Mutor
B Mutator
C Access
D Accessor
MCQ 36 Introduction

Which of the following method can be called without creating an instance of a class ?

A Instance method
B Class method
C Constructor method
D All of these
MCQ 37 Introduction

In Inheritance models consist of which type of relationship between two classes ?

A have - a
B was - a
C is - a
D has - a
MCQ 38 Introduction

How to define user define no-argument constructor ?

A Room ( ) { };
B Room { } ( );
C Room < > ( );
D Room [ ] { };
MCQ 39 Introduction

In Java, Parent class can be referred to as which of the following ?

A Parent class, Super class, Base class
B Parent class, Extended class, Base class
C Sub class, Base class, Super class
D Sub class, Derived class, Extended class
MCQ 40 Introduction

In Java, which step is followed to create an object from a class ?

A Declaration
B All of these
C Initialization
D Instantiation
MCQ 41 Introduction

Which type of variables are defined inside methods or blocks ?

A Local variables
B Instance variables
C All of these
D Class variables
MCQ 42 Introduction

In Java, a class is generally made up of which components ?

A Behaviour, Variable
B Name, Attributes
C Class, Variable
D Attributes, Behaviour
MCQ 43 Introduction

Which of the following represents the type of variable ?

A Local variables
B Instance variables
C Class variables
D All of these
MCQ 44 Introduction

Which of the following prefix is utilize for conventionally naming of Accessor and Mutator method respectively ?

A post, get
B get, post
C get, set
D set, get
MCQ 45 Introduction

Mutator method is known as what in Java ?

A get
B set
C getter
D setter
MCQ 46 Introduction

Which of the following defines attributes and methods ?

A Object
B Instance
C Class
D Variable
MCQ 47 Introduction

In Java, which keyword is used to declare Class variable ?

A class
B new
C var
D static
MCQ 48 Introduction

Which are the for P’s used in the four levels of visibility to provide necessary protection ?

A Process, Private, Protected, Public
B Public, Package, Protected, Private
C Private, Package, Protected, Public
D Public, Package, Protected, Process
MCQ 49 Introduction

Which of the following keyword is used to declare Class variables and Class methods ?

A static
B variable
C class
D object
MCQ 50 Introduction

Which type of variables are defined with in a class, outside any method with the β€˜static’ keyword ?

A All of these
B Class variables
C Instance variables
D Local variables
MCQ 51 Introduction

Which of the following in Object-oriented programming language provide reusability feature ?

A Constructors
B Inheritance
C Polymorphism
D Objection
MCQ 52 Introduction

All instances of class are allocated memory in data structure is called what ?

A Zeap
B Reap
C Heap
D Leap
MCQ 53 Introduction

If we want to make visible to all the classes outside the class, where method or variable is visible to class, which type of access modifier is used ?

A Protected
B Private
C Package
D Public
MCQ 54 Introduction

In Java, a Sub class inherits all instance variables and methods from which class ?

A Derived class
B Child class
C Extended class
D Super class
MCQ 55 Introduction

In Java, which step of creating an object from a class initialize the newly created object ?

A All of these
B Instantiation
C Declaration
D Initialization
MCQ 56 Introduction

Which of the following is syntax of package ?

A Package {Package Name};
B Package (Package Name);
C PackageΒ ;
D Package [Package Name];
MCQ 57 Introduction

In Java, which keyword is used to call the constructor of super class in the constructor of sub class ?

A super
B extends
C class
D sub
MCQ 58 Introduction

Which of the following operator creates an object and returns its reference ?

A object
B class
C dot (.)
D new
MCQ 59 Introduction

A variable declared using class type can store what to an object ?

A reference
B class
C heap
D variable
MCQ 60 Introduction

Accessor method is known as what in Java ?

A set
B setter
C get
D getter
MCQ 61 Introduction

In Java class, which operator is used to access instance variable and instance method via object ?

A , (comma)
B : (colon)
C . (dot)
D ; (semicolon)
MCQ 62 Introduction

In Java, a Sub class can be derived from which class ?

A Child class
B Super class
C Extended class
D Owner class
MCQ 63 Introduction

In Java, which step a β€˜new’ keyword is used to create the object by allocating memory ?

A All of these
B Instantiation
C Initialization
D Declaration
MCQ 64 Classification of variables declared in a class

Which type of variables are defined within a class but outside any method ?

A Instance variables
B Local variables
C Class variables
D All of these
MCQ 65 Visibility modifiers for Access Control

Which of the following is the highest level of protection in Java ?

A Package
B Public
C Private
D Provided
MCQ 66 Inheritance

In Java, Child class can be referred to as which of the following ?

A Sub class, Derived class, Extended class
B Parent class, Super class, Base class
C Parent class, Extended class, Base class
D Sub class, Base class, Super class
MCQ 67 Polymorphism(Method overloading)

Which of the following is the meaning of Polymorphism ?

A User forms
B Virtual forms
C Many forms
D Single form
MCQ 68 Accessing instance variables and calling instance methods

What is the associativity of . (dot) operator which is used to access instance variable ?

A Lower to Upper
B Upper to Lower
C Right to Left
D Left to Right
MCQ 69 Visibility modifiers for Access Control

Which level of protection is used to allow the access only to sub classes or to share with the methods declared as β€œfriend” in Java ?

A Public
B Private
C Protected
D Package
MCQ 70 Introduction

What does a class contain?

A Data & Method
B Data & Program code
C Only Data
D Only program code
MCQ 71 Introduction

What does a class contain?

A Data & Method
B Data & Program code
C Only Data
D Only program code
MCQ 72 Introduction

In class, Data is referred to as ………….

A Attributes
B behavior
C state
D function
MCQ 73 Introduction

In Java functions referred to as …………..

A Attributes
B behavior
C state
D Method
MCQ 74 Introduction

When a program contains 2 or more classes, only one class can contain the …………method.

A main( )
B String( )
C class
D private
MCQ 75 Introduction

What is a template for multiple objects with similar features?

A class
B Method
C Attribute
D Behavior
MCQ 76 Introduction

In Java, a class is defined using which keyword?

A Public
B class
C name
D Attribute
MCQ 77 Introduction

In Java, a class is defined using which keyword?

A Public
B class
C name
D Attribute
MCQ 78 Introduction

Every class is made up with how many components?

A attribute
B behavior
C state
D Both a and b
MCQ 79 Introduction

What are defined by variables in a class?

A Behavior
B Attribute
C State
D methods
MCQ 80 Introduction

Which of the following is used to access or modify attributes?

A Method
B class
C Attribute
D Behavior
MCQ 81 Introduction

What is defined by method in a class?

A Method
B class
C Attribute
D Behavior
MCQ 82 Introduction

Write the right steps to create an object.

A Declaration
B Instantiation
C Initialization.
D All of these
MCQ 83 Introduction

Declaring a variable does not create an ………….in Java.

A Object
B method
C Attribute
D Behavior
MCQ 84 Introduction

Variable of class type are also referred to as …………variables.

A reference
B Global
C Allocated
D Constant
MCQ 85 Introduction

Which operator allocates the memory for an object and returns the address of object?

A new
B object
C class
D Method
MCQ 86 Introduction

What do we call the address of the memory location where the object is stored?

A Address
B Reference
C Allocated
D Constant
MCQ 87 Introduction

What do we call the special portion of memory where the objects live?

A Reference
B Heap
C Address
D Structure
MCQ 88 Introduction

When an object is created, then which special method is executed to perform initial task?

A Constructor
B Method
C Attributes
D Function
MCQ 89 Introduction

Which constructor is called with empty parentheses without arguments?

A Object constructor
B default constructor
C Method
D Parameterized constructor
MCQ 90 Introduction

When statement β€œr1=new Room( );” is executed then what is stored in r1?

A Address of an object
B Reference of an object
C Heap
D All of these
MCQ 91 Introduction

Which of the following is the correct syntax to declare and create an object in a single line?

A Room r2=new Room( );
B room r=room();
C Room r1=room()
D Room =Room(new);
MCQ 92 Introduction

In Java, which of the following looks for unused objects and reclaims the memory that those objects are using?

A Variable collector
B Garbage collector
C Class collector
D Object collector
MCQ 93 Introduction

In Java, creating an object with β€žnewβ€Ÿ key word is also called object ……………..

A Declaration
B Instantiation
C Initialization
D All of these
MCQ 94 Introduction

Which type of variables is created at the time of creating an object and stay throughout the life of the ojects ?

A Local
B Instance
C Static
D null
MCQ 95 Introduction

Which type of variable is define by the attributes of an object?

A Local
B Instance
C Static
D null
MCQ 96 Introduction

In Java,…………..can be defined inside a class only.

A method
B class
C Attributes
D State
MCQ 97 Introduction

All instance of class are allocated memory in which data structure?

A heap
B constructor
C Inherit
D Overload
MCQ 98 Introduction

What is the associativity of dot operator

A L to R
B R to L
C T to B
D B to T
MCQ 99 Introduction

Instance variables and instance methods can be referred by using ………….operators.

A dot ( . )
B comma( β€ž )
C semicolon( ; )
D colon( : )
MCQ 100 Introduction

Referring instance variable or invoking method with null reference will give ………...

A output
B Error
C Object
D Class
MCQ 101 Introduction

Instance methods are used to define …………of an object.

A Attribute
B Behavior
C state
D Functions
MCQ 102 Introduction

Variable belongs to a class and not to an …………

A Attribute
B Object
C Behavior
D method
MCQ 103 Introduction

Which variables are called the class variable can be declared within class using static keyword before data type ?

A Memory
B static
C local
D instance
MCQ 104 Introduction

What do we call the variables that defined inside methods or blocks?

A Local variable
B Class variable
C Static variable
D Instance variable
MCQ 105 Introduction

What do we call the variables that are defined within a class but outside any method?

A Instance variable
B Class variable
C Static variable
D Local variable
MCQ 106 Introduction

Which variables are initialized with default value?

A Instance and class variable
B Class and local variables
C class and static variable
D Static and Instance variable
MCQ 107 Introduction

What do we call the term where different forms of methods are used with same name?

A Polymorphism
B Inheritance
C constructor
D Aggregation
MCQ 108 Introduction

The word ……………..means many forms.

A Polymorphism
B Inheritance
C constructor
D Aggregation
MCQ 109 Introduction

Which term means, different methods that have the same name but a different signature?

A Method overloading
B Inheritance
C Constructor
D Aggregation
MCQ 110 Introduction

Which of the following are the steps to create Polymorphism?

A Method name
B type of return value
C a list of parameters
D All of these
MCQ 111 Introduction

What do we call the special method that is invoked when a new object is created?

A Polymorphism
B Constructor
C Inheritance
D All of these
MCQ 112 Introduction

Every class is having its default ……………

A Polymorphism
B Constructor
C Inheritance
D All of these
MCQ 113 Introduction

Which type of constructor does not take any argument?

A Default
B Parameterized
C Multi level
D Multiple
MCQ 114 Introduction

Which is mainly designed to perform initializing actions?

A Constructor
B Polymorphism
C Inheritance
D All of these
MCQ 115 Introduction

Constructor does not have ……………….type.

A return
B void( )
C default
D All of these
MCQ 116 Introduction

Constructor is invoked implicitly only when an object is constructed using ………..operator.

A new
B default
C new( )
D +
MCQ 117 Introduction

Constructor must have the …………..name as class name.

A same
B new name
C different
D default
MCQ 118 Introduction

Which of the following is the correct for the Constructor? i. Constructor must have the same name as class name. ii. Constructor does not have return type. iii. Constructor is invoked implicitly only when an object is constructed using new operator. iv. Constructor can not be invoked explicitly else

A i, ii, iii, iv
B i, ii, v, iii
C v, i ,iv, iii
D v, i, iii,,iv
MCQ 119 Introduction

Access control means to control ……….

A visibility
B program
C Objects
D Attributes
MCQ 120 Introduction

In absence of user define constructor in a class, objects are constructed using which type of constructor?

A Default
B no – argument
C Parameterized
D multilevel
MCQ 121 Introduction

Which of the following is known as a user-defined no-argument constructor?

A { } [ ];
B ( ) {};
C ( ) [ ];
D [ ] ( );
MCQ 122 Introduction

Which of the following is the meaning of polymorphism?

A Single form
B Post text
C Post morphism
D Many forms
MCQ 123 Introduction

What is known as visibility modifier?

A Access modifier
B Constructor
C Polymorphism
D Inheritance
MCQ 124 Introduction

Which of the following is a part of Four Pβ€Ÿs Protection in Java?

A Private
B Package, Protected
C Public
D All of these
MCQ 125 Introduction

Which of the following is not a part of Four Pβ€Ÿs protection in Java?

A public
B package
C private
D provided
MCQ 126 Introduction

Which type of access modifiers are used before the type of variable or method?

A public
B protected
C private
D All of these
MCQ 127 Introduction

Which of the following access modifier is used to organized classes?

A Public
B Package
C Private
D Protected
MCQ 128 Introduction

Write down the syntax of package.

A package &lt;packageName&gt;;
B package (packageName)
C package [packageName]
D All of the above
MCQ 129 Introduction

Which access modifier provides visibility to classes defined in the other package?

A public
B package
C Private
D Protected
MCQ 130 Introduction

To provide public access, which keyword type before method or variable type?

A Private
B Public
C Protected
D Package
MCQ 131 Introduction

Public variables and methods are …………..anywhere.

A visible
B invisible
C outside
D inside
MCQ 132 Introduction

Which of the following is the highest level of protection in Java?

A Private
B Package
C Public
D Protected
MCQ 133 Introduction

What is the other name of mutator method?

A set
B setter
C getter
D get
MCQ 134 Introduction

What is the other name for accessor method.

A get
B getter
C setter
D set
MCQ 135 Introduction

Which level of protection is used to allow the access only to subclasses or to share with the methods declared as β€œfriend”?

A public
B protected
C Private
D Package
MCQ 136 Introduction

Which keyword is used to share data of private class?

A friend
B extends
C throw
D get
MCQ 137 Introduction

Which protection level cannot be seen by any other class?

A Private
B Protected
C Public
D Package
MCQ 138 Introduction

If we want private data to be used by other, then which method is used?

A accessor
B access
C excess
D mutator
MCQ 139 Introduction

If we want to allow private data to be modified by others, then which method is used?

A accessor
B access
C excess
D mutator
MCQ 140 Introduction

Which of the following prefix is utilize for conventionally naming of mutator method?

A wait
B set
C get
D take
MCQ 141 Introduction

Which of the following prefix is utilize for conventionally naming of accessor method?

A wait
B set
C get
D take
MCQ 142 Introduction

If we want to allow other methods to read only the data value, then which method is used?

A getter
B get
C set
D setter
MCQ 143 Introduction

If we want to allow other methods to modify the data value, then which method is used?

A getter
B get
C set
D setter
MCQ 144 Introduction

Find the valid getter or setter names from the list. (1) getLength (2) GetLength (3) getlength (4) setLength (5)SetLength (6) setAttribute

A 1,3,4,6
B 1,4,6
C 1,2,3,4
D 1,3,4,6
MCQ 145 Introduction

Which facility allows us to build new class with added capabilities by extending existing class?

A Inheritance
B Constructor
C Polymorphism
D Aggregation
MCQ 146 Introduction

Inheritance model is based on which type of relationship between two classes?

A has - a – part
B is – a – kind
C is-a-kind-of
D both b or c
MCQ 147 Introduction

In inheritance, Parent class is also referred to as………….class.

A super
B base
C sub
D both a and b
MCQ 148 Introduction

In inheritance, Child class is also referred to as …………..class.

A sub
B derived
C extended
D All of these
MCQ 149 Introduction

In which class common features are kept?

A super
B extended
C sub
D None of above
MCQ 150 Introduction

Which class inherits all instance variables and methods from super class, and it may have its own added variables and methods?

A Base class
B Subclass
C Sub class
D None of above
MCQ 151 Introduction

What is not inherited in sub class?

A Constructor
B Method
C Polymorphism
D Super class
MCQ 152 Introduction

Which keyword is used to create a subclass in the class definition?

A derived
B extends
C Super
D new
MCQ 153 Introduction

Which keyword is used to call the constructor of super class in the constructor of sub class?

A extends
B super
C extends
D new
MCQ 154 Introduction

When super class and sub class have methods with same signature, a super class method is said to be ………….. in the sub class.

A overloading
B overridden
C operator loading
D None of above
MCQ 155 Introduction

All instance variable and methods are inherited from super class to …………..class.

A sub
B Parent
C super
D new
MCQ 156 Introduction

Java does not support …………….type of inheritances.

A multiple
B Single
C multi level
D constructor
MCQ 157 Introduction

A subclass can be derived from only the …………..class.

A Super
B new
C Extended
D sub
MCQ 158 Introduction

Which of the following are the construction of classes that incorporate other objects. They establish a β€œhas-a” relationship between classes?

A Composition
B aggregation
C Constructor
D Both a or b
MCQ 159 Introduction

Composition & aggregation establish which type of relationship between classes?

A has – a – part
B has – a
C is-a-kind-of
D Both a or b
MCQ 160 Introduction

Which symbol is used in Inheritance?

A Arrow
B Circle
C Diamond
D Triangle
MCQ 161 Constructors

In java, which of the following can not be invoked explicitly elsewhere in the program?

A class
B constructor
C class variable
D display() method
MCQ 162 Introduction

In Java, in which steps of object creation, constructor is called to initialize the newly created object?

A Declaration
B Instantiation
C Initialization
D Modification
MCQ 163 Introduction

Which part of Java looks for unused objects and reclaims the memory that those objects are using?

A new keyword
B heap area
C constructor
D garbage collector
MCQ 164 Introduction

In Java, which kind of variables are allocated memory from heap area when an object is created?

A Instance variables
B Local variables
C Class variables
D Global variables
MCQ 165 Introduction

In Java, which of the following returns a reference to an object that represents an instance of the class?

A Super
B New keyword
C Extends
D Class keyword
MCQ 166 Introduction

In Java, which of the following allows us to build new class with added capabilities by extending existing class?

A Accessor method
B Mutator method
C Inheritance
D Constructor
MCQ 167 Introduction

In Java, which of the following are the construction of classes that incorporate other objects?

A variables and literals
B new keyword and class keyword
C accessor and mutator methods
D composition and aggregation
MCQ 168 Introduction

Use of which protection of Java will become more relevant when we use inheritance concept of object-oriented programming?

A Public
B Private
C Protected
D Package
MCQ 169 Introduction

In Java, which of the following is a proper syntax to define class?

A
B
C
D
MCQ 170 Introduction

In Java, instance variables and instance methods are referred by using which operator?

A dot (.) operator
B plus (+) operator
C Hyphen (-) operator
D Under score (_ ) operator
MCQ 171 Introduction

In Java; which of the following can not be invoked explicitly elsewhere in the program?

A class
B constructor
C class variables
D display ( ) method
MCQ 172 Introduction

Which kind of Java class variables are allocated memory from heap area when an object is created?

A Local variables
B Class variables
C Instance variables
D Static variables
MCQ 173 Introduction

In Java, which keyword is used to define class?

A new
B class
C static
D auto
MCQ 174 Introduction

In Java, which keyword is used to define class methods?

A class
B new
C int
D static
MCQ 175 Introduction

In Java, which of the following is a special kind of method that is invoked when a new object is created?

A Constructor
B Heap
C Garbage collector
D Visibility modifier
MCQ 176 Introduction

In Java, which methods can be used to define behaviour of an object?

A Class Methods
B Instance Methods
C Local Methods
D Global Methods
MCQ 177 Introduction

When methods of the super class and subclass have same name and signature, what are they called?

A Overloaded methods
B Overridden methods
C Abstracted methods
D Local methods
MCQ 178 Introduction

In Java, in which step of creating an object, constructor is called to initialize the newly created object?

A Declaration
B Modification
C Instantiation
D Initialization
MCQ 179 Introduction

In Java, which level of protection is used to allow the access only to subclasses or to share with the methods declared as β€œfriend’’?

A Public
B Private
C Protected
D Package
MCQ 180 Introduction

In switch statement of Java, which statement is executed when no match is found?

A Break
B Default
C Continue
D Case
MCQ 181 Introduction

Which of the following names is given to the existing class in object oriented terminology?

A Super Class
B Sub Class
C Child Class
D Derived Class
MCQ 182 Introduction

In Java, which method is used, when we want to allow private data to be used by others?

A Accessor
B Mutator
C New
D Void
MCQ 183 Classification of variables declared in a class

In Java, which of the following are variables defined within a class but outside any method? .

A local variables
B instance variables
C class variables
D main variables
MCQ 184 Introduction

Which of the following are fundamental parts of object-oriented programming?

A method and class
B object and class
C object and method
D None of the given
MCQ 185 Introduction

Which method is used to display attribute of β€˜Classroom’ object?

A list()
B show()
C display()
D print()
MCQ 186 Introduction

An inheritance model refers to which of the following relationships?

A is - a
B has - a
C have – a
D All of the given
MCQ 187 Introduction

Which method is overridden in subclass when superclass and subclass have methods with same signature?

A Subclass
B Superclass
C Both A and B
D None of the given
MCQ 188 Introduction

Which of the following access modifier has no precise name?

A Public
B Private
C Package
D Protection
MCQ 189 Introduction

What does 'polymorphism' means in Java?

A Many forms.
B Different forms of methods with same name
C Method overloading
D All of the given
MCQ 190 Introduction

A method in Java is created in ____________

A an object
B class
C an array
D stream
MCQ 191 Introduction

Which of the following variable/s is/are initialized with default values?

A class
B instance
C local
D Both A and B
MCQ 192 Introduction

In Java, ___________________ can be defined inside the class only.

A Comment
B method
C loop
D None of the given
MCQ 193 Introduction

Default constructor is no more available in presence of ______________in a class.

A user-defined constructor
B loop
C function
D None of the given
MCQ 194 Introduction

Which of the following defines attributes?

A Method
B Function
C Variable
D All of the given
MCQ 195 Introduction

Which variable/s is/are initialized with default values?

A Instance variable
B Class variable
C Both A & B
D None of the given
MCQ 196 Introduction

Which class in Java contains all the features/ attributes of inheritance?

A super
B sub
C main
D None of the given
MCQ 197 Introduction

What is used to invoke display() method within show() method of superclass?

A List.display()
B Super.display()
C Sub.display()
D Show.display()
MCQ 198 Introduction

The scope of which access modifier is narrower than public variables?

A private
B protected
C package
D All of the given
MCQ 199 Introduction

In Java, when different methods are created using the same name, it is called _____________

A constructor
B inheritance
C polymorphism
D multiple method
MCQ 200 Introduction

In Java, by which other name an object is known as ?

A Variable
B Method
C Class instance
D Class parameter
MCQ 201 Introduction

In Java, a class name can be used to specify _________________________

A type of variable in a declaration statement
B the type of a formal parameter
C the return type of a function
D All of the given
MCQ 202 Introduction

The best way to provide data encapsulation is to make as much data as ___________ as possible.

A package
B protected
C private
D public
MCQ 203 Introduction

The ___________________ returns a reference to an object that represents an instance of the class.

A new keyword
B constructor
C variable
D None of the given
MCQ 204 Introduction

Every Java class is made up of ________________ component.

A attribute
B behaviour
C A or B
D None of the given
MCQ 205 Introduction

Which variables are defined inside methods or blocks?

A instance variable
B local variable
C Both A and B
D None of the given
MCQ 206 Introduction

In inheritance, a __________inherits all instance variables and methods from superclass.

A superclass
B subclass
C master class
D slave class
MCQ 207 Introduction

Which of the following in Java establish a 'has-a' relationship between classes?

A Aggregation
B Composition
C Both A and B
D None of the given
MCQ 208 Introduction

The variable or method of which access modifier can be accessed from anywhere in Java?

A public
B private
C package
D All of the given
MCQ 209 Introduction

Which of the following give initial value to the variable?

A Method
B constructor
C variable
D Method overloading
MCQ 210 Introduction

In object-oriented programming languages, creating an object is called __________________

A object instantiation
B object creation
C object modification
D All of the given
MCQ 211 Introduction

Which of the following adds constructor without variable in Java?

A Room {}();
B Room [] {};
C Room <> {};
D Room ( ){};
MCQ 212 Introduction

Which of the following is/are required to create an object from a class?

A Declaration
B Instantiation
C Initialization
D All of the given
MCQ 213 Introduction

Which of the following access modifiers are used before the type of variable or method?

A public
B protected
C private
D All of the given
MCQ 214 Introduction

Which keyword is used to create the object from Java class?

A new
B obj
C create
D None of the given
MCQ 215 Introduction

Which variable/s is/are defined within a class but outside any method?

A Local
B Global
C Instance
D All of the given
MCQ 216 Introduction

Which keyword is used to create a subclass in the class definition?

A sub
B create
C below
D extends
MCQ 217 Introduction

When a class in a Java inherits the objects of other class, it is known as __________________

A subclass
B superclass
C container class
D master class
MCQ 218 Introduction

Which of the following access modifier is used to access only subclasses?

A private
B public
C package
D protected
MCQ 219 Introduction

Which of the following is also known as no-argument constructors?

A Default constructor
B Null constructor
C Access constructor
D All of the given
MCQ 220 Introduction

In Java, the actual data is contained inside the ______________

A class
B object
C method
D All of the given
MCQ 221 Introduction

Which variables are not initialized by default values?

A Local
B Class
C Instance
D All of the given
MCQ 222 Introduction

The method's signature is a combination of ________________

A name of method
B the type of return value
C a list of parameters
D All of the given
MCQ 223 Introduction

_____________ are special methods with same name as class name, no arguments and no return type.

A Constructor
B Instance variable
C Package
D None of the given
MCQ 224 Introduction

Which of the following keyword is used to create an object?

A new
B create
C make
D insert
MCQ 225 Introduction

Which of the following variables are allocated memory from heap area when an object is instantiated?

A global
B local
C instance
D class
MCQ 226 Introduction

Which of the following keyword is used to invoke a superclass constructor in subclass constructor?

A sup
B super
C key
D call
MCQ 227 Introduction

What is the other name of 'Mutator Method' ?

A mutator
B access
C getter
D setter
MCQ 228 Introduction

Which of the following access modifier provides highest level of protection in Java?

A public
B private
C package
D All of the given
MCQ 229 Introduction

In Java, an attempt to create an object using constructor without argument results in _____

A 0
B 1
C -1
D error
MCQ 230 Introduction

What is stored in heap?

A class
B object
C class address
D None of the given
MCQ 231 Introduction

Instance variables and instance methods are accessed via __________

A .
B >
C <
D ?
MCQ 232 Introduction

Which of the following can be accessed from instance methods?

A Instance variable
B Class variable
C Class methods
D All of the given
MCQ 233 Introduction

In Java, an attempt to create an object using constructor without arguments compiler ________

A returns error
B uses default constructor
C creates new constructor
D None of the given
MCQ 234 Introduction

What is heap?

A Special portion of memory
B Mixture of memory
C Keyword in java
D All of the given
MCQ 235 Introduction

Which variables are defined within a class outside any method and with the static keyword?

A Local variable
B Instance variable
C Both A and B
D Class variable
MCQ 236 Introduction

Which variable can be accessed without creating an instance of a class?

A static variable
B object variable
C global variable
D All of the given
MCQ 237 Introduction

What is the other name of Accessor method?

A getter
B setter
C input
D output
MCQ 238 Introduction

Which access modifier provides the narrowest visibility?

A Package
B Public
C Private
D Protected
MCQ 239 Introduction

Which of the following modifier is used to organize classes?

A Public
B Private
C Protected
D Package
MCQ 240 Introduction

Which of the following is performed by constructor when an object of class is created?

A Initializing actions
B Memory allocation
C Both A and B
D None of the given
MCQ 241 Introduction

__________variables are allocated memory only once per class and is shared by all its objects.

A class
B instance
C local
D All of the given
MCQ 242 Introduction

Which of the following is accessible from other source files and packages?

A public variable
B public method
C Both A and B
D package variable
MCQ 243 Introduction

Access modifiers are also known as __________

A visibility modifiers
B privacy modifiers
C protocol modifiers
D program modifiers
MCQ 244 Constructors

which Is a special kind of method that is invoked when a new object is created ?

A local
B instance
C constructors
D static
MCQ 245 Visibility modifiers for Access Control

Which of the following level of protection is used to allow the access only to subclasses or to share with friend methods?

A protected
B public
C package
D private
MCQ 246 Class variables and class methods

What is the name of variables of class type refferd to as?

A related
B dynamic
C refernce
D all of the above
MCQ 247 Class in Java

How many components are used to made up every class in java ?

A 1
B 2
C 3
D 4
MCQ 248 Objects

Which of the following steps are required for creating an object from a class?

A Declaration, Instantiation,Initialization
B Declaration, Initialization, Instantiation
C Instantiation, Initialization, Declaration
D Initialization, Instantiation, Declaration
MCQ 249 Classification of variables declared in a class

In java, which variables are defined with static keyboard ?

A Class
B Instance
C Local
D All of the above
MCQ 250 Introduction

Which of the following is a special kind of method that is invoked when a new object is created ?

A Class
B Instance
C Constructor
D Object
MCQ 251 Introduction

In Java, which step is followed to create an object from a class ?

A Declaration
B All of these
C Initialization
D Instantiation
MCQ 252 Introduction

Which access modifier provides visibility to classes defined in the other package?

A public
B package
C Private
D Protected
MCQ 253 Constructors

In java, which of the following can not be invoked explicitly elsewhere in the program?

A class
B constructor
C class variable
D display() method
MCQ 254 Introduction

In Java, in which steps of object creation, constructor is called to initialize the newly created object? Compiled by Nuzhat Memon 15

A Declaration
B Instantiation
C Initialization
D Modification
MCQ 255 Introduction

Which part of Java looks for unused objects and reclaims the memory that those objects are using?

A new keyword
B heap area
C constructor
D garbage collector
MCQ 256 Introduction

In Java, which kind of variables are allocated memory from heap area when an object is created?

A Instance variables
B Local variables
C Class variables
D Global variables
MCQ 257 Introduction

In Java, which of the following returns a reference to an object that represents an instance of the class?

A Super
B New keyword
C Extends
D Class keyword
MCQ 258 Introduction

In Java, which of the following allows us to build new class with added capabilities by extending existing class?

A Accessor method
B Mutator method
C Inheritance
D Constructor
MCQ 259 Introduction

In Java, which of the following are the construction of classes that incorporate other objects?

A variables and literals
B new keyword and class keyword
C accessor and mutator methods
D composition and aggregation
MCQ 260 Introduction

Use of which protection of Java will become more relevant when we use inheritance concept of object-oriented programming?

A Public
B Private
C Protected
D Package
MCQ 261 Introduction

In Java, instance variables and instance methods are referred by using which operator?

A dot (.) operator
B plus (+) operator
C Hyphen (-) operator
D Under score (_ ) operator
MCQ 262 Introduction

In Java; which of the following can not be invoked explicitly elsewhere in the program?

A class
B constructor
C class variables
D display ( ) method
MCQ 263 Introduction

Which kind of Java class variables are allocated memory from heap area when an object is created?

A Local variables
B Class variables
C Instance variables
D Static variables
MCQ 264 Introduction

In Java, which keyword is used to define class?

A new
B class
C static
D auto
MCQ 265 Introduction

In Java, which keyword is used to define class methods?

A class
B new
C int
D static
MCQ 266 Introduction

In Java, which of the following is a special kind of method that is invoked when a new object is created?

A Constructor
B Heap
C Garbage collector
D Visibility modifier
MCQ 267 Introduction

When methods of the super class and subclass have same name and signature, what are they called?

A Overloaded methods
B Overridden methods
C Abstracted methods
D Local methods
MCQ 268 Introduction

In Java, in which step of creating an object, constructor is called to initialize the newly created object?

A Declaration
B Modification
C Instantiation
D Initialization
MCQ 269 Introduction

In switch statement of Java, which statement is executed when no match is found?

A Break
B Default
C Continue
D Case
MCQ 270 Introduction

Which of the following names is given to the existing class in object oriented terminology?

A Super Class
B Sub Class
C Child Class
D Derived Class
MCQ 271 Introduction

In Java, which method is used, when we want to allow private data to be used by others?

A Accessor
B Mutator
C New
D Void
MCQ 272 Objects

Which of the following steps are required for creating an object from a class?

A Declaration, Instantiation,Initialization
B Declaration, Initialization, Instantiation
C Instantiation, Initialization, Declaration
D Initialization, Instantiation, Declaration
MCQ 273 Introduction

In Java, which keyword is used to create the object by allocating memory ?

A super
B add
C new
D class
MCQ 274 Introduction

In Java, a class is defined using which keyword ?

A class
B CLASS
C All of these
D Class
MCQ 275 Introduction

In Java, how many levels of visibility modifiers are available for access control ?

A 3
B 2
C 5
D 4
MCQ 276 Introduction

If we want to make visible to all the classes outside the class, where method or variable is visible to class, which type of access modifier is used ?

A Protected
B Private
C Package
D Public
MCQ 277 Introduction

Accessor method is known as what in Java ?

A set
B setter
C get
D getter
MCQ 278 Introduction

In Java class, which operator is used to access instance variable and instance method via object ?

A , (comma)
B : (colon)
C . (dot)
D ; (semicolon)
MCQ 279 Introduction

Every class is made up with how many components?

A attribute
B behavior
C state
D Both a and b
MCQ 280 Introduction

In Java, which of the following looks for unused objects and reclaims the memory that those objects are using?

A Variable collector
B Garbage collector
C Class collector
D Object collector
MCQ 281 Introduction

All instance of class are allocated memory in which data structure?

A heap
B constructor
C Inherit
D Overload
MCQ 282 Introduction

Instance methods are used to define …………of an object.

A Attribute
B Behavior
C state
D Functions
MCQ 283 Introduction

Constructor does not have ……………….type.

A return
B void( )
C default
D All of these
MCQ 284 Introduction

Constructor must have the …………..name as class name.

A same
B new name
C different
D default
MCQ 285 Introduction

Public variables and methods are …………..anywhere.

A visible
B invisible
C outside
D inside
MCQ 286 Introduction

In inheritance, Child class is also referred to as …………..class.

A sub
B derived
C extended
D All of these
MCQ 287 Introduction

Java does not support …………….type of inheritances.

A multiple
B Single
C multi level
D constructor
MCQ 288 Introduction

Composition & aggregation establish which type of relationship between classes?

A has – a – part
B has – a
C is-a-kind-of
D Both a or b
MCQ 289 Introduction

In Java, which kind of variables are allocated memory from heap area when an object is created?

A Instance variables
B Local variables
C Class variables
D Global variables
MCQ 290 Introduction

In Java, which of the following are the construction of classes that incorporate other objects?

A variables and literals
B new keyword and class keyword
C accessor and mutator methods
D composition and aggregation
MCQ 291 Introduction

Use of which protection of Java will become more relevant when we use inheritance concept of object-oriented programming?

A Public
B Private
C Protected
D Package
MCQ 292 Introduction

In Java, which keyword is used to define class methods?

A class
B new
C int
D static
MCQ 293 Introduction

When methods of the super class and subclass have same name and signature, what are they called?

A Overloaded methods
B Overridden methods
C Abstracted methods
D Local methods
MCQ 294 Introduction

In Java, which level of protection is used to allow the access only to subclasses or to share with the methods declared as β€œfriend’’?

A Public
B Private
C Protected
D Package
MCQ 295 Introduction

In switch statement of Java, which statement is executed when no match is found?

A Break
B Default
C Continue
D Case
MCQ 296 Introduction

The scope of which access modifier is narrower than public variables?

A private
B protected
C package
D All of the given
MCQ 297 Introduction

The best way to provide data encapsulation is to make as much data as ___________ as possible.

A package
B protected
C private
D public
MCQ 298 Introduction

In inheritance, a __________inherits all instance variables and methods from superclass.

A superclass
B subclass
C master class
D slave class
MCQ 299 Introduction

Access modifiers are also known as __________

A visibility modifiers
B privacy modifiers
C protocol modifiers
D program modifiers
MCQ 300 Introduction

In Java, which step is followed to create an object from a class ?

A Declaration
B All of these
C Initialization
D Instantiation
MCQ 301 Introduction

In Java, in which step of creating an object, constructor is called to initialize the newly created object?

A Declaration
B Modification
C Instantiation
D Initialization
MCQ 302 Class variables and class methods

In Java, which keyword is used before data type to declare class variables?

A static
B new
C super
D public
MCQ 303 Visibility modifiers for Access Control

IF WE WANT TO MAKE VISIBLE TO ALL THE CLASSES OUTSIDE THE CLASS, WHICH TYPE OF ACCESS MODIFIER IS USED.

A PROTECTED
B PACKAGE
C PUBLIC
D PRIVATE
MCQ 304 Methods

FROM THE FOLLOWING WHICH OPREATOR IS USED TO ACCESS INSTANCE VARIABLE AND INSTANCE IN JAVA.

A : (COLON)
B ; (SEMICON)
C . (DOT)
D , ( COMMA)
MCQ 305 Introduction

In Java, how many levels of visibility modifiers are available for access control ?

A 3
B 2
C 5
D 4
MCQ 306 Introduction

If we want to allow other methods to modify the data value, then which method is used ?

A getter
B write
C setter
D reader
MCQ 307 Introduction

Accessor method is known as what in Java ?

A set
B setter
C get
D getter
MCQ 308 Polymorphism(Method overloading)

Which of the following is the meaning of Polymorphism ?

A User forms
B Virtual forms
C Many forms
D Single form
MCQ 309 Visibility modifiers for Access Control

Which level of protection is used to allow the access only to sub classes or to share with the methods declared as β€œfriend” in Java ?

A Public
B Private
C Protected
D Package
MCQ 310 Introduction

In class, Data is referred to as ………….

A Attributes
B behavior
C state
D function
MCQ 311 Introduction

In Java functions referred to as …………..

A Attributes
B behavior
C state
D Method
MCQ 312 Introduction

Every class is having its default ……………

A Polymorphism
B Constructor
C Inheritance
D All of these
MCQ 313 Introduction

Access control means to control ……….

A visibility
B program
C Objects
D Attributes
MCQ 314 Introduction

In inheritance, Child class is also referred to as …………..class.

A sub
B derived
C extended
D All of these
MCQ 315 Introduction

An inheritance model refers to which of the following relationships?

A is - a
B has - a
C have – a
D All of the given
MCQ 316 Introduction

Every Java class is made up of ________________ component.

A attribute
B behaviour
C A or B
D None of the given
MCQ 317 Introduction

In Java, an attempt to create an object using constructor without argument results in _____

A 0
B 1
C -1
D error
MCQ 318 Objects

Which of the following steps are required for creating an object from a class?

A Declaration, Instantiation,Initialization
B Declaration, Initialization, Instantiation
C Instantiation, Initialization, Declaration
D Initialization, Instantiation, Declaration
MCQ 319 Introduction

All instance of class are allocated memory in which data structure?

A heap
B constructor
C Inherit
D Overload
MCQ 320 Introduction

Constructor does not have ……………….type.

A return
B void( )
C default
D All of these
MCQ 321 Introduction

In Java, in which step of creating an object, constructor is called to initialize the newly created object?

A Declaration
B Modification
C Instantiation
D Initialization