C++ Questions

Q:

How many types of constructor are there in C++?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: C) 3

Explanation:

There are three types of constructor in C++. They are Default constructor, Parameterized constructor, Copy constructor.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4134
Q:

What is friend function?

Answer


The function declaration should be preceded by the keyword friend.The function definitions does not use either the keyword or the scope operator :: The functions that are declared with the keyword friend as friend function.Thus, a friend function is an ordinary function or a member of another class.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

2 4103
Q:

Why is it expensive to use objects for exception?

A) Exception object is created only if an error actually happens B) Because of execution time
C) Memory space involved in creating an exception object D) None of the mentioned
 
Answer & Explanation Answer: A) Exception object is created only if an error actually happens

Explanation:

If an error occurs in program, then only exception object is created otherwise, It will not be created. So it’s expensive to use in the program.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4082
Q:

What is the scope resolution operator?

Answer

Scope resolution operator allows a program to reference an identifier in the global scope that is hidden by another identifier with the same name in the local scope.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

1 4033
Q:

Where does the exceptions are used?

A) Exceptions are used when postconditions of a function cannot be satisfied. B) Exceptions are used when postconditions of a function can be satisfied.
C) To preserve the program D) none of these
 
Answer & Explanation Answer: B) Exceptions are used when postconditions of a function can be satisfied.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4021
Q:

What is meant by heap?

A) Used for fast reterival of elements B) Used for organising the elements
C) Both a & b D) None of the mentioned
 
Answer & Explanation Answer: C) Both a & b

Explanation:

A heap is a way to organize the elements of a range that allows for fast retrieval of the element.

Report Error

View Answer Report Error Discuss

Filed Under: C++

2 3992
Q:

Where does the allocaters are implemented?

A) Template library B) Standard library
C) C++ code library D) None of these
 
Answer & Explanation Answer: B) Standard library

Explanation:

Allocaters are implemented in C++ standard library but it is used for C++ template library.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3891
Q:

What are the methods are available in storing sequential files?

A) Natural merging B) Polyphase sort
C) Distribution of Initial runs D) All the above
 
Answer & Explanation Answer: D) All the above

Explanation:

ll the above listed methods are used in storing sequential files

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3874