Object Oriented Programming Questions asked in HCL

Question 1

Time: 00:00:00

Which of the following is correct about class and structure?

class can have member functions while structure cannot.

class can have member functions while structure cannot.

class data members are public by default while that of the structure are private.

class data members are public by default while that of the structure are private.

Pointer to structure or classes cannot be declared.

Pointer to structure or classes cannot be declared.

class data members are private by default while that of the structure are public by default.

class data members are private by default while that of the structure are public by default.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00

Which of the following concepts means waiting until runtime to determine which function to call?

Data hiding

Data hiding

Dynamic casting

Dynamic casting

Dynamic binding

Dynamic binding

Dynamic loading

Dynamic loading

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which of the following concepts is used to implement late binding?

Virtual function

Virtual function

Operator function

Operator function

Const function

Const function

Static function

Static function

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00

Which one of the following is the correct way to declare a pure virtual function?

virtual void Display(void){0};

virtual void Display(void){0};

virtual void Display = 0;

virtual void Display = 0;

virtual void Display(void) = 0;

virtual void Display(void) = 0;

void Display(void) = 0;

void Display(void) = 0;

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Which of the following approach is followed by Object Oriented Language during the execution of a program?

Bottom up approach

Bottom up approach

Top down approach

Top down approach

Both a and b

Both a and b

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What is the output of this program?

class PrintTest {
public static void main(String args[])
{
int num = 10;
if (NUM < 100) {
System.out.println("The value of num is"+ num);
}
}
}

Compilation error

Compilation error

Run time error

Run time error

The value of num is 10

The value of num is 10

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00

Which of the following concepts provides the facility of using object of one class inside another class?

Encapsulation

Encapsulation

Abstraction

Abstraction

Composition

Composition

Inheritance

Inheritance

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00

Which of the following is correct about function overloading?

The types of arguments are different.

The types of arguments are different.

The order of argument is different.

The order of argument is different.

The number of argument is same.

The number of argument is same.

Both A and B.

Both A and B.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00

Which of the following functions are performed by a constructor?

Construct a new class

Construct a new class

Construct a new object

Construct a new object

Construct a new function

Construct a new function

Initialize objects

Initialize objects

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
What will happen if a class is not having any name?

It cannot have a destructor

It cannot have a destructor

It cannot have a constructor.

It cannot have a constructor.

It is not allowed.

It is not allowed.

Both A and B.

Both A and B.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice! \r\n \r\n","Keep trying! \r\n \r\n","Not bad! \r\n \r\n","Good work! \r\n \r\n","Perfect! \r\n \r\n"]

Hey ! Follow us on G+