C++ MCQ’s

C++ MCQ’s Home Page

C++ Basic 1
C++ Basic 2
C++ Basic 3
C++ Basic 4
C++ Basic 5
C++ OOPs Concepts 1
C++ OOPs Concepts 2
C++ OOPs Concepts 3
C++ OOPs Concepts 4
C++ OOPs Concepts 5

 

Cpp Language MCQ’S | OOPs Concepts Set 4

11.
Which of the following operator(s) can be used with pointers?
i) * , &
ii) +, *
iii) +, –
iv) +, -, /
v) /
vi) + only

a) i only
b) vi only
c) ii and v
d) iv

 

12.
What is std in C++?

a) std is a standard class in C++
b) std is a standard namespace in C++
c) std is a standard header file in C++
d) std is a standard file reading header in C++

 

13.
What will be the output of the following C++ code?

#include <iostream>

int main(int argc, char const *argv[])
{
cout<<“Hello World”;
return 0;
}

a) Hellow World
b) Compile-time error
c) Run-time error
d) Segmentation fault

 

14.
Which of the following syntax can be used to use a member of a namespace without including that namespace?

a) namespace::member
b) namespace->member
c) namespace.member
d) namespace~member

 

15.
Which of the following C++ code will give error on compilation?

================code 1=================
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
cout<<“Hello World”;
return 0;
}
========================================
================code 2=================
#include <iostream>
int main(int argc, char const *argv[])
{
std::cout<<“Hello World”;
return 0;
}
========================================
a) Both code 1 and code 2
b) Code 1 only
c) Code 2 only
d) Neither code 1 nor code 2