106 C And C++ MCQ Questions in english हिन्दी

Share:

C and C++ are kinds of middle-level computer languages. Programming in C++, an object-oriented language, offers applications a distinct structure and encourages code reuse, which reduces development costs. Applications that can be converted to different platforms can be created using C++ because it is portable.  C++ is closer to the compiler and faster than C language. It is a statically typed programming language i.e it uses static typing when type checking is performed during compile-time as opposed to run time. Learning C++ is enjoyable and simple. C++ is a superset of the C language. Let's do a quiz about C and C++ Languages that will help you to level up your knowledge and prepare for exams.


What are the advantages of using C++ input and output over C input and output?

What will the following C++ code produce? #include using namespace std; int main () { int a, b, c; a = 2; b = 7; c = (a > b) ? a : b; cout << c; return 0; }

banner ad

How do structures and classes vary in C++?

What would the following C++ code snippet produce? #include using namespace std; int operate (int a, int b) { return (a * b); } float operate (float a, float b) { return (a / b); } int main() { int x = 5, y = 2; float n = 5.0, m = 2.0; cout << operate(x, y) <<"\t"; cout << operate (n, m); return 0; }

Which concept in C++ allows you to reuse previously written code?

What will the following C++ programme produce? #include using namespace std; int main() { try { try { throw 20; } catch (int n) { cout << "Inner Catch\n"; throw; } } catch (int x) { cout << "Outer Catch\n"; } return 0; }

Which of the following constructors are provided by the C++ compiler if they are not defined in a class?

What exactly is an abstract class in C++?

What will the C++ programme below produce? #include using namespace std; int main() { int n = 5; void *p = &n; int *pi = static_cast(p); cout << *pi << endl; return 0; }

banner ad

What will the result of the following C++ application be? #include #include using namespace std; int main () { std::string str ("Sanfoundry."); str.back() = '!'; std::cout << str << endl; return 0; }

What exactly is a polymorphism in C++?

What will the following C++ code produce? #include using namespace std; void square (int *x, int *y) { *x = (*x) * --(*y); } int main ( ) { int number = 30; square(&number, &number); cout << number; return 0; }

What will the following C++ programme produce? #include using namespace std; int main() { int a = 5; auto check = [=]() { a = 10; }; check(); cout<<"Value of a: "<

In C++, which of the following symbols is used to declare preprocessor directives?

What will the following C++ code produce? #include using namespace std; int main() { int a = 5; float b; cout << sizeof(++a + b); cout << a; return 0; }

In C++, what is inheritance?

banner ad

The C++ code that causes an abnormal programme termination/behavior should be written in the block.

In C++, what is the acceptable syntax for accessing a static member of a class? --------------------------- Example class: class A { public: static int value; } ---------------------------

In C++, which keyword is used to define macros?

What will the result of the following C++ code be? #include using namespace std; int main() { char c = 74; cout << c; return 0; }

In C++, which of the following is used to end the function declaration?

What will the result of the following C++ application be? #include #include #include using namespace std; int main(int argc, char const *argv[]) { const char *a = "Hello\0World"; cout<

Which is more efficient when invoking C++ functions?

banner ad

In C++, what is the purpose of indentation?

What will the following C++ code ? #include using namespace std; int main () { int cin; cin >> cin; cout << "cin: " << cin; return 0; }

Explanation: cin is a variable hence overrides the cin object. cin >> cin has no meaning so no error.

What does this declaration mean? int x : 4

The result will be if the input is abcdefg.

What does the phrase "printf("%d", (a++)")"

×
Subscribe now

for Latest Updates

Articles, Jobs, MCQ and many more!