Campus/Interview preparation with C++ Language
Starting with Important topic of C ++ Language :-
![]() |
campus/interview preparation |
Objective type questions or multiple choice questions (MCQ) are often asked in various exams, including job recruitment tests. It also helps in understanding language constructs, syntax and fundamental rules.click the link given in above list to go to that topic.
(a) Equal strings
(b)Unequal strings
(c) No output
(d) Compilation error
If this article is helpful to you then please like share and comments.. Thank you..
Standard Template Library (STL)
1.
What does STL stand for?
What does STL stand for?
(a) Simple
Template Library
(b) Standard Template Library
(c) Static Type Library
(d) Single Type¬based Library
(b) Standard Template Library
(c) Static Type Library
(d) Single Type¬based Library
Answer
(b) STL stands for Standard Template Library
2.
STL is based on which of the following programming paradigms?
STL is based on which of the following programming paradigms?
(a)
Structured Programming
(b) Object Oriented Programming (OOP)
(c) Functional Programming
(d) Aspect Oriented Programming (AOP)
(b) Object Oriented Programming (OOP)
(c) Functional Programming
(d) Aspect Oriented Programming (AOP)
Answer
(c) Functional Programming
3.
Which of the STL containers store the elements contiguously (in adjecent memory locations)?
Which of the STL containers store the elements contiguously (in adjecent memory locations)?
(a)
std::vector
(b) std::list
(c) std::map
(d) std::set
(b) std::list
(c) std::map
(d) std::set
Answer
(d) std::set
4.
Find the output of this:
Find the output of this:
#include
using namespace std;
main()
{
char s= “hello”,
t = “hello”;
if (s = = t)
Cout<<“equal strings”;
}
using namespace std;
main()
{
char s= “hello”,
t = “hello”;
if (s = = t)
Cout<<“equal strings”;
}
(a) Equal strings
(b)Unequal strings
(c) No output
(d) Compilation error
Answer
(c) No output, as we are comparing both base
addresses and are not same.
5.
What kind of iteration does forward_list provide in C++?
What kind of iteration does forward_list provide in C++?
(a)
Uni-directional
(b) Bi-directional
(c) Multi-directional
(d) None of the mentioned
(b) Bi-directional
(c) Multi-directional
(d) None of the mentioned
Answer
(a) In the forward_list, the container provides
insertion and removal at anywhere in the program.
6.
What does the size of the vector refers to in c++?
What does the size of the vector refers to in c++?
(a) Size of
vector
(b) Type of vector
(c) Number of elements
(d) None of the mentioned
(b) Type of vector
(c) Number of elements
(d) None of the mentioned
Answer
(d) none.
7.
What is the use of adapter in STL in c++?
What is the use of adapter in STL in c++?
(a) To
provide interface
(b) To manipulate the data
(c) To extract the data
(d) None of the mentioned
(b) To manipulate the data
(c) To extract the data
(d) None of the mentioned
Answer
(a) Adapters are data types from STL that adapt
a container to provide specific interface.
8.
What is the output of this program?
What is the output of this program?
#include
#include
using namespace std;
int main ()
{
Vector < int > myvector;
myvector.push_back (78);
myvector.push_back (16);
myvector. Front () += myvector. Back ();
Cout << myvector. Front () << ‘\n’;
return 0;
}
#include
using namespace std;
int main ()
{
Vector < int > myvector;
myvector.push_back (78);
myvector.push_back (16);
myvector. Front () += myvector. Back ();
Cout << myvector. Front () << ‘\n’;
return 0;
}
(a) 78
(b) 16
(c) 94
(d) None of the mentioned
(b) 16
(c) 94
(d) None of the mentioned
Answer
(c)
In this program, we added all the values in the vector by using front and back operation.
Output:
$ g++ seqc1.cpp
$ a.out
94.
In this program, we added all the values in the vector by using front and back operation.
Output:
$ g++ seqc1.cpp
$ a.out
94.
9.
Which is used to iterate over container?
Which is used to iterate over container?
(a)
Associated iterator type
(b) Data type of objects
(c) Return type of variables
(d) None of the mentioned
(b) Data type of objects
(c) Return type of variables
(d) None of the mentioned
Answer
(a) None
10.
Which is not C++ storage class
Which is not C++ storage class
(a) auto
(b) register
(c) static
(d) iostream
(b) register
(c) static
(d) iostream
Answer
(d)
Storage classes are:
Storage classes are:
auto
register
static
extern
register
static
extern
If this article is helpful to you then please like share and comments.. Thank you..
Comments
Post a Comment