C++ MCQs with answers Page - 89

Here, you will find a collection of MCQ questions on C++. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833.24K Points
Coach

Q. Can we overload functions in C++?

  • (A) Yes
  • (B) No
  • (C) Compilation Error
  • (D) Runtime Error

A

Admin • 833.24K Points
Coach

Q. What is the output of below program?

Code:
#include<iostream.h>
void Execute(int &x, int y = 200)
{
 int TEMP = x + y;
 x+= TEMP;
 if(y!=200)
     cout<<TEMP<<x<<y"--";
}

int main()
{
 int A=50, B=20;
 cout<<A<<B<<"--";
 Execute(A,B);
 cout<<A<<B<<"--";
 return 0;
}
  • (A) 5020--7050200--5020--
  • (B) 5020--70120200--5020
  • (C) 5020--7012020--12020--
  • (D) 5020--5020--

A

Admin • 833.24K Points
Coach

Q. What is currect syntax of for loop?

  • (A) for(initialization, condition, increment/decrement
  • (B) for(initialization;condition; increment/decrement)
  • (C) for(increment/decrement; initialization; condition)
  • (D) None of These

A

Admin • 833.24K Points
Coach

Q. Can we typecast void * into int *?

  • (A) Yes
  • (B) No
  • (C) Undefined
  • (D) Depends on Compiler

A

Admin • 833.24K Points
Coach

Q. What should be the output of below program?

Code:
int main()
{
int a=10; 
cout<<a++;
return 0;
}
  • (A) 0
  • (B) 10
  • (C) 11
  • (D) Error

A

Admin • 833.24K Points
Coach

Q. Which operator has more precedence in below list?

  • (A) *
  • (B) ++
  • (C) -
  • (D) +

A

Admin • 833.24K Points
Coach

Q. Which operator can not be overloaded?

  • (A) ::
  • (B) *
  • (C) -
  • (D) +

A

Admin • 833.24K Points
Coach

Q. What is size of int data type in cpp?

  • (A) 1 Byte
  • (B) 2 Bytes
  • (C) 4 Bytes
  • (D) Depends on Compiler

A

Admin • 833.24K Points
Coach

Q. What is following operator called?
?:

  • (A) if else o/p
  • (B) Ternary Operator
  • (C) Conditional Operator
  • (D) Scope Resolution Operator

A

Admin • 833.24K Points
Coach

Q. What is the output of below program?

Code:
int main()
{
 if(0)
 {
    cout<<"Hi";
 }
 else
 {
    cout<<"Hello";
 }
return 0;
}
  • (A) Hi
  • (B) Hello
  • (C) HiHello
  • (D) Compilation Error

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ