Object Oriented Programming MCQs

Page No. 15

Which constructor will be called from the object obj2 in the following program?


aA(int x)

✖


bA(int y)

✖


cA(int y, int x)

✓


dA(int y; int x)

✖


View Answer A(int y, int x)

Which among the following is not valid in java?


aConstructor overloading

✖


bRecursive constructor call

✓


cDefault value constructors

✖


dString argument constructor

✖



If programmer have defined parameterized constructor only, then __________________


aDefault constructor will not be created by the compiler implicitly

✓


bDefault constructor will be created by the compiler implicitly

✖


cDefault constructor will not be created but called at runtime

✖


dCompile time error

✖



Why do we use constructor overloading?


aTo use different types of constructors

✖


bBecause it’s a feature provided

✖


cTo initialize the object in different ways

✓


dTo differentiate one constructor from another

✖



Which among the following function can be used to call default constructor implicitly in java?


athis( )

✓


bthat( )

✖


csuper( )

✖


d sub( )

✖


View Answer this( )

When is the constructor called for an object?


aAs soon as overloading is required

✖


bAs soon as class is derived

✖


cAs soon as class is created

✖


dAs soon as object is created

✓



Which among the following is false for a constructor?


aConstructors doesn’t have a return value

✖


bConstructors are always user defined

✓


cConstructors are overloaded with different signature

✖


dConstructors may or may not have any arguments being accepted

✖



Which constructor will be called from the object created in the code below?


aDefault constructor

✖


bParameterized constructor

✖


cCompile time error

✓


dRun time error

✖


View Answer Compile time error

Which among the following is possible way to overload constructor?


aDefine default constructor, 1 parameter constructor and 2 parameter constructor

✓


bDefine default constructor, zero argument constructor and 1 parameter constructor

✖


cDefine default constructor, and 2 other parameterized constructors with same signature

✖


dDefine 2 default constructors

✖



Does constructor overloading include different return types for constructors to be overloaded?


aYes, if return types are different, signature becomes different

✖


bYes, because return types can differentiate two functions

✖


cNo, return type can’t differentiate two functions

✖


dNo, constructors doesn’t have any return type

✓



Goto Page No.

Page 15 of 93

Alphabetical MCQs Categories
—

Here below You find all kind of categories of MCQs in alphabetical order.


"Comprehensive Collection of MCQs: Alphabetically Organized by Subject"
—

"Discover an extensive collection of multiple-choice questions (MCQs) neatly categorized by subject from A to Z. This resource is designed for anyone eager to explore various topics in a straightforward and organized manner. Whether you're a student preparing for exams, an educator seeking supplementary materials, or simply curious about different subjects, this compilation offers a convenient way to learn and assess your knowledge. With questions arranged alphabetically, navigation is effortless, allowing you to delve into subjects of interest at your own pace. Engage, learn, and expand your understanding with this accessible and comprehensive repository of MCQs!"


BolPakistan

bolpakistan.com.pk includes Job Mcqs and Pak Mcqs is the Top Largest Mcqs Forum in World, in which you can read Mcqs of All Subjects, PPSC test preparation, FPSC, NTS and PPSC PAST PAPERS, PPSC PAST MCQS. A Collection of Repeated MCQs for JOBs seekers.

Copyright © 2024, Designed & Developed by BolPakistan