Sail E0 Webinar

MCQs

Total Questions : 10
Question 1.

What is the use of <exception> header


  1.    Contains the standard exception files
  2.    Contains the standard library files
  3.    It is used to arise an exception in the program
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> Contains the standard exception files

None.


Question 2.

Pick out parameter for rehash method in unordered_set in c++?


  1.    count
  2.    size
  3.    hash
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> count

count is used to return the new number of buckets.


Question 3.

What is meant by standard c++ library?


  1.    It is the collection of class definitions for standard data structures and a collection of algorithms
  2.    It is a header file
  3.    Both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> It is the collection of class definitions for standard data structures and a collection of algorithms

It is the collection of class definitions for standard data structures. This part of the library was 

derived from the Standard Template Library.


Question 4.

Pick out the wrong header file.
a) <algorithm>
b) <containers>
c) <iterators>
d) <process>


  1.    It is the collection of class definitions for standard data structures and a collection of algorithms
  2.    It is a header file
  3.    Both a & b
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> It is the collection of class definitions for standard data structures and a collection of algorithms

Answer: (d)
Explanation:
None.



Question 5.


What is the output of this program?


1.
#include
2.
#include
3.
#include
4.
using namespace std ;
5.
typedef list LISTSTR;
6.
int main()
7.
{
8.
LISTSTR :: iterator i;
9.
LISTSTR test;
10.
test.insert(test.end(), "one");
11.
test.insert(test.end(), "two");
12.
LISTSTR test2(test);
13.
LISTSTR test3(3, "three");
14.
LISTSTR test4(++test3.begin(),
15.
test3.end());
16.
cout
  1.    test
  2.    test one
  3.    test two
  4.    None of the mentioned
 Discuss Question
Answer: Option D. -> None of the mentioned

In this program, We used the list to manipulate the given value.
Output:
$ g++ std3.cpp
$ a.out
test: one
two
test: one
two
test: three
three
three
test: three
three


Question 6.


What is the output of this program?


1.
#include
2.
#include
3.
#include
4.
using namespace std;
5.
int main()
6.
{
7.
queue q;
8.
q.push('a');
9.
q.push('b');
10.
q.push('c');
11.
cout
  1.    ab
  2.    abc
  3.    a
  4.    Error
 Discuss Question
Answer: Option B. -> abc

In this program, We used the queue to process the given input.
Output:
$ g++ std1.cpp
$ a.out
abc


Question 7.

1. Pick out the wrong header file about strings.
a) <string>
b) <regex>
c) <ios>
d) None of the mentioned


  1.    no trailing underscores on names
  2.    complex objects are returned by value
  3.    have a member-swap()
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned

Answer:c
Explanation:
The standard header files for string is string and regex. So the wrong one presented 

here is ios.



Question 8.

What is meant by vector in the container library contains?


  1.    It is a sequence container that encapsulates dynamic size arrays
  2.    It is a sequence container that encapsulates static size arrays
  3.    It manages the memory
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> It is a sequence container that encapsulates dynamic size arrays

vector in the container library contains sequence container that manipulates and encapsulates 

dynamic size arrays.


Question 9.


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
vector v;
7.
v.assign( 10, 42 );
8.
for (int i = 0; i < v.size(); i++)
9.
{
10.
cout
  1.    42
  2.    42 42
  3.    424
  4.    42 for 10 times
 Discuss Question
Answer: Option D. -> 42 for 10 times

In this program, We used the vector to print the 42 for 10 times.
Output:
$ g++ std.cpp
$ a.out
42 42 42 42 42 42 42 42 42 42


Question 10.

Which is best for coding the standard libary for c++?


  1.    no trailing underscores on names
  2.    complex objects are returned by value
  3.    have a member-swap()
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned

None.


Latest Videos

Latest Test Papers