Questions · Page 1 of 10

MCQ

🎯

Test yourself on this topic

50 questions · timed · auto-graded

MCQ 11 Mark
Which of the following arrow, points from subclass towards superclass?
  • B
  • C
  • D
Answer
Correct option: A.
View full question & answer
MCQ 21 Mark
Who enables creating classes as composition and aggregation of objects?
  • Use of object as an instance variable in class
  • B
    Use of -object as static variable in class
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Use of object as an instance variable in class
Use of object as an instance variable in class
View full question & answer
MCQ 31 Mark
What is advisable to be used as “public” for protection purpose?
  • A
    Private instance variables
  • B
    ‘getter’ and ‘setter’ methods
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 41 Mark
Specify the purpose of access modifiers.
  • To determine visibility of instance members
  • B
    To determine the data type of instance members
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
To determine visibility of instance members
To determine visibility of instance members
View full question & answer
MCQ 51 Mark
Which members of the class are shared by all objects of the class?
  • Static members
  • B
    Private members
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Static members
Static members
View full question & answer
MCQ 61 Mark
How many times are static members allocated memory per class?
  • Only once
  • B
    Twice
  • C
    Not possible
  • D
    None of these
Answer
Correct option: A.
Only once
Only once
View full question & answer
MCQ 71 Mark
Which keyword is used to define class-variable and method?
  • A
    class
  • B
    new
  • C
    super
  • static
Answer
Correct option: D.
static
static
View full question & answer
MCQ 81 Mark
Which of the following variables belong to each object?
  • Instance
  • B
    Method
  • C
    Class
  • D
    None of these
Answer
Correct option: A.
Instance
Instance
View full question & answer
MCQ 91 Mark
What is called implicitly when an object is instantiated using ‘new’ operator?
  • A
    main0
  • Constructor
  • C
    Access or
  • D
    Mutator
Answer
Correct option: B.
Constructor
Constructor
View full question & answer
MCQ 101 Mark
Which of the following is the special method with the same name as class name with no argument and no return type?
  • A
    main0
  • Constructor
  • C
    Access or
  • D
    Mutator
Answer
Correct option: B.
Constructor
Constructor
View full question & answer
MCQ 111 Mark
Because of which type of relationship between ‘Library’ and ‘Room’, ‘Library’ class is not inherited from ‘Room’ class?
  • ‘has - a’
  • B
    ‘is-a’
  • C
    ‘is - not - a’
  • D
    None of these
Answer
Correct option: A.
‘has - a’
‘has - a’
View full question & answer
MCQ 121 Mark
If we define class ‘Library’, it has a reading room, then which type of relationship exists between ‘Library’ and ‘Room’?
  • ‘has - a’
  • B
    ‘is-a’
  • C
    ‘is-not-a’
  • D
    None of these
Answer
Correct option: A.
‘has - a’
‘has - a’
View full question & answer
MCQ 131 Mark
Which kind of relationship exists between ‘Library’ and ‘Room’?
  • ‘has - a’
  • B
    ‘is-a’
  • C
    ‘is - not - a’
  • D
    None of these
Answer
Correct option: A.
‘has - a’
‘has - a’
View full question & answer
MCQ 141 Mark
What a class is referred as when a class includes objects of other class?
  • A
    Sub
  • B
    Super
  • Container
  • D
    Parent
Answer
Correct option: C.
Container
Container
View full question & answer
MCQ 151 Mark
Which of the following shows “has-a” relationship?
  • Library → Reading room (an object of Room class)
  • B
    Class room 1 and Class room2
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Library → Reading room (an object of Room class)
Library → Reading room (an object of Room class)
View full question & answer
MCQ 161 Mark
Which relationship do composition and aggregation establish between classes?
  • A
    ‘is - a’
  • ‘has - a’
  • C
    ‘is - not - a’
  • D
    None of these
Answer
Correct option: B.
‘has - a’
‘has - a’
View full question & answer
MCQ 171 Mark
Which of the following is a construction of classes that incorporates other object?
  • A
    Composition
  • B
    Aggregation
  • C
    Polymorphism
  • a and b both
Answer
Correct option: D.
a and b both
a and b both
View full question & answer
MCQ 181 Mark
How many super classes are needed to derive a subclass?
  • Only one
  • B
    Two
  • C
    Five
  • D
    Many
Answer
Correct option: A.
Only one
Only one
View full question & answer
MCQ 191 Mark
Which kind of inheritance does Java not support?
  • Multilevel
  • B
    Nested
  • C
    Single level
  • D
    None of these
Answer
Correct option: A.
Multilevel
Multilevel
View full question & answer
MCQ 201 Mark
‘protected’ members are available as the following type of members in the inherited subclass.
  • A
    public
  • private
  • C
    package
  • D
    None of these
Answer
Correct option: B.
private
private
View full question & answer
MCQ 211 Mark
Which method is used to make private members available elsewhere?
  • A
    getter
  • B
    setter
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 221 Mark
Which of the following members are directly available in the class in which they are defined?
  • private
  • B
    protected
  • C
    package
  • D
    public
Answer
Correct option: A.
private
private
View full question & answer
MCQ 231 Mark
Instances having which of the following visibility are available for direct use in the entire package?
  • A
    protected
  • B
    private
  • package
  • D
    public
Answer
Correct option: C.
package
package
View full question & answer
MCQ 241 Mark
Which of the following syntax is used for not overriding the method in the subclass when superclass and subclass have methods with the same signature?
  • A
    _method name
  • super, method name
  • C
    super. method name
  • D
    None of these
Answer
Correct option: B.
super, method name
super, method name
View full question & answer
MCQ 251 Mark
Which method is said to be overridden in the subclass when superclass and subclass have methods with the same signature?
  • Superclass
  • B
    Child
  • C
    Extended
  • D
    a and b both
Answer
Correct option: A.
Superclass
Superclass
View full question & answer
MCQ 271 Mark
Which keyword is used to call the constructor of superclass in the constructor of subclass?
  • super
  • B
    new
  • C
    class
  • D
    extends
Answer
Correct option: A.
super
super
View full question & answer
MCQ 281 Mark
Which keyword is used to create a subclass in the class definition?
  • extends
  • B
    SC
  • C
    sub
  • D
    subclass
Answer
Correct option: A.
extends
extends
View full question & answer
MCQ 291 Mark
Which is the class that usually contains more information and methods than its superclass?
  • Sub
  • B
    Parent
  • C
    Master
  • D
    Index
Answer
Correct option: A.
Sub
Sub
View full question & answer
MCQ 301 Mark
What is inherited in a subclass?
  • A
    Constructor
  • B
    Method
  • C
    Instance variable
  • b and c both
Answer
Correct option: D.
b and c both
b and c both
View full question & answer
MCQ 311 Mark
What is not inherited in a subclass?
  • Constructor
  • B
    Method
  • C
    Instance variable
  • D
    All of these
Answer
Correct option: A.
Constructor
Constructor
View full question & answer
MCQ 321 Mark
Which of the following variables and methods does a subclass contain?
  • A
    Inherited from superclass
  • B
    Its own added.
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 331 Mark
Which of the following does a subclass inherit from the superclass?
  • A
    All instance variables
  • B
    Methods
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 341 Mark
To which of the following classes are common features kept?
  • Super
  • B
    Sub
  • C
    Child
  • D
    Extended
Answer
Correct option: A.
Super
Super
View full question & answer
MCQ 351 Mark
Which type of class is child class known as?
  • A
    sub
  • B
    Extended
  • a and b both
  • D
    Parent
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 361 Mark
Which type of class is parent class known as?
  • A
    Super
  • B
    Base
  • a and b both
  • D
    Child
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 371 Mark
Classroom is a Room and student is a Person. Here, which type of class is called ‘Room’ and ‘Person’ as well?
  • A
    Subclass
  • B
    Extended class
  • C
    a and b both
  • Parent class
Answer
Correct option: D.
Parent class
Parent class
View full question & answer
MCQ 381 Mark
Which of the following allows us to build new class with added capabilities by extending existing class?
  • Inheritance
  • B
    Polymorphism
  • C
    Encapsulation
  • D
    Aggregation
Answer
Correct option: A.
Inheritance
Inheritance
View full question & answer
MCQ 391 Mark
Using which of the following, object-oriented programming languages provide reusability feature?
  • Inheritance
  • B
    Polymorphism
  • C
    Encapsulation
  • D
    Aggregation
Answer
Correct option: A.
Inheritance
Inheritance
View full question & answer
MCQ 401 Mark
Which type of relationship does inheritance have between two classes?
  • A
    ‘has - a’
  • ‘is - a’
  • C
    ‘is-not - a’
  • D
    None of these
Answer
Correct option: B.
‘is - a’
‘is - a’
View full question & answer
MCQ 411 Mark
Which parameters are not affecting actual parameters on making changes to them?
  • Formal
  • B
    Minor
  • C
    Primitive
  • D
    None of these
Answer
Correct option: A.
Formal
Formal
View full question & answer
MCQ 421 Mark
The values of which of the following parameters are copied to formal parameters and then function is executed?
  • A
    Primitive
  • Actual
  • C
    Minor
  • D
    None of these
Answer
Correct option: B.
Actual
Actual
View full question & answer
MCQ 431 Mark
Which of the following variables can be passed as parameters?
  • Primitive
  • B
    Actual
  • C
    Formal
  • D
    None of these
Answer
Correct option: A.
Primitive
Primitive
View full question & answer
MCQ 441 Mark
While using access or and mutator method, it is a must to write ‘get’ and ‘set’ method for the following one only.
  • A
    For each class
  • For each instance variable
  • C
    For each integer object
  • D
    None of these
Answer
Correct option: B.
For each instance variable
For each instance variable
View full question & answer
MCQ 451 Mark
Which of the following minor inconvenience will reward us with an ease of reusability and maintenance?
  • Use of access or and mutator method
  • B
    Use of constructor
  • C
    Use of main0 method
  • D
    None of these
Answer
Correct option: A.
Use of access or and mutator method
Use of access or and mutator method
View full question & answer
MCQ 461 Mark
Which of the following method seems little difficult to write?
  • Use of access or and mutator method
  • B
    Use of constructor
  • C
    Use of main0 method
  • D
    None of these
Answer
Correct option: A.
Use of access or and mutator method
Use of access or and mutator method
View full question & answer
MCQ 471 Mark
Use of which of the following methods will prevent the variables from getting directly accessed and modified by other users of the class?
  • Use of access or and mutator method
  • B
    Use of constructor
  • C
    Use of main0 method
  • D
    None of these
Answer
Correct option: A.
Use of access or and mutator method
Use of access or and mutator method
View full question & answer
MCQ 481 Mark
Which of the following is an example of “getter” method (Access or method)?
  • get Length 0
  • B
    Get Length 0
  • C
    get length 1
  • D
    set Length 0
Answer
Correct option: A.
get Length 0
get Length 0
View full question & answer
MCQ 491 Mark
What is mutator method also known as?
  • setter
  • B
    getter
  • C
    modifier
  • D
    verifier
Answer
Correct option: A.
setter
setter
View full question & answer
MCQ 501 Mark
What is access or method also known as?
  • getter
  • B
    setter
  • C
    modifier
  • D
    verifier
Answer
Correct option: A.
getter
getter
View full question & answer
MCQ - Computer STD 12 Commerce Questions - Vidyadip