TCS Papers: Sample Questions 433 - 435 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 433

» Languages » C & C Plus Plus

MCQ▾

Question

How many instances of an abstract class can be created?

Choices

Choice (4) Response

a.

1

b.

0

c.

13

d.

5

Answer

b.

Explanation

  • No, you cannot create an instance of an abstract class because it does not have complete implementation.

  • Abstract class functions as a base for subclasses- like a template, or an empty or partially empty structure. It has to be extended before using.

  • Abstract classes can have consts, members, method stubs and defined methods, whereas interfaces can only have consts and methods.

    abstract class MyAbstractClass

    {

    }

    MyAbstractClass obj = new MyAbstractClass (); //not valid

  • Compiling the above code, generates the Error message: “Cannot create an instance of the abstract class or interface”.

Abstract class in image

Abstract Class in Image

Given the image is define the abstract class

Question number: 434

» Languages » C & C Plus Plus

MCQ▾

Question

Which of the following operator is overloaded for object cout?

Choices

Choice (4) Response

a.

< <

b.

=

c.

> >

d.

+

Answer

a.

Explanation

  • We use insertion operator ( < < ) for the object (cout) of output stream.

  • So this is the operator that gets used. Hence the answer is < < .

  • To send output to the screen we use the insertion operator on the object cout.

  • Format: cout < < Expression;

Image shows the Cout object

Image Shows the Cout Object

Given the image is define the insertion operation using in cout object

Question number: 435

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What are linked list?

Explanation

  • A linked list is composed of nodes that are connected with one-another.

  • In C programming, linked lists are created using pointers.

  • Linked lists is efficient way of utilizing memory for storage.

  • Linked list consists of sequence of nodes.

  • Each node is composed of two fields: data field and reference field pointing to the next node.

  • Each node in the list is also called an element.

The image is define the C Linked list example

The Image is Define the C Linked List Example

Given the image is define the C Linked list example