WorksheetsContructors
Total questions: 30
Worksheet time: 12mins
What is the output of the given program?
Object will be created Successfully
Compile Time Error
Successfully Compiled, but no output
None
What is the output?
Sample
Compile Time error
Successfully comiled, but nothing will be printed
None
What is the output?
Compile Time error
Sample
Nothing will be printed
Run Time error
What is the output?
Compile Time error
During object creation virtual Default constructor will be created
Run Time error
None
What is a Constructor _________
Constructor is a Special Operator
Constructor is a Special keyword
Constructor is a Special Method
Constructor is a Special variable
What is the Syntax of the Constructor?
return_type Name()
{
}
data_type Name()
{
}
modifier Name()
{
}
none
When the constructor will be called/invoked?
It will not invoke directly, we need to call it explicitly
It will be invoked automatically during the object creation
It will be invoked during the main() method execution
None
What is the difference between constructor & method?
Constructor Name is as like as class name
Method name need not be the class name
Constructor Name need not be the class name
Method name is as like as class name
Constructor should not have return type
Method should have the return type
Constructor should have the return type
Method should not have return type
What is the output?
Sample
Successfully Compiled, nothing will be printed
Compile Time Error
Runtime Error
What is the output?
Sample1
Sample
Sample
Sample1
Compile Time error
Runtime Error
What is the output?
Sample1
Sample
Sample
Sample1
Compile Time Error
Nothing will be printed
What is the output?
Sample
Sample1
Sample2
Sample1
Sample
Sample2
Compile Time error
Runtime Error
What is the output?
Sample
Sample1
Sample
Sample
Sample1
Sample1
Compile Time Error
What is the output?
Sample
Sample
Sample1
Sample1
Compile Time Error
Runtime error
What is the output?
Sample
Sample1
Compile Time Error
Runtime Error
What is the output?
Compile Time Error
Sample1
Sample
Nothing will be printed
What is the output?
Compile Time Error
Sample
Sample1
Nothing will be printed
What is the output?
Sample
Sample1
Compile Time Error
Nothing will be printed
What is the output?
myMethod
myMethod1
Compile Time Error
Runtime Error
What is the output?
Sample
Sample1
Sample1
Sample
Compile Time Error
Nothing will be printed
What is the output?
Sample
Sample1
Sample1
Sample
Compile Time Error
Nothing will be printed
what is the output?
Sample
Sample1
Sample1
Sample
Nothing will be printed
Compile Time Error
What is the output?
Sample1
Default constructor with empty body will be called
Sample
Sample
Default constructor with empty body will be called
Compile Time Error
Which of the following is the Deep copy in object Assignment?
Use the = operator to assign one object to another object
use copy constructor to assign one object values to another values
creating new object by using keyword "new"
All the above
Which of the following is the Shallow copy/Reference copy in object Assignment?
Use the = operator to assign one object to another object
use copy constructor to assign one object values to another values
creating new object by using keyword "new"
All the above
What is the output?
10 20
10 20
50 60
50 60
10 20
10 20
50 60
10 20
10 20
10 20
10 20
50 60
10 20
10 20
50 60
10 50
What is the output?
10 20
10 20
50 60
10 20
10 20
10 20
50 60
50 60
10 20
50 60
50 60
10 20
10 20
50 60
50 60
50 60
What is the output?
Sample
Initializer
Initializer
Sample
Compile time error
Nothing will be printed
What is the output?
10
20
20
10
Nothing will print
Compile time error
what is the output?
Sample1
Sample
Sample1
Nothing will be printed
Compile time error
