C++ MCQs with answers Page - 88

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. In C++ array subscript always starts with

  • (A) 0
  • (B) 1
  • (C) -1
  • (D) Any positive integer

A

Admin • 833.24K Points
Coach

Q. Which of the following function is used to open a file in C++?

  • (A) fopen
  • (B) fclose
  • (C) fseek
  • (D) fgets

A

Admin • 833.24K Points
Coach

Q. What is the output of below program?

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

A

Admin • 833.24K Points
Coach

Q. What is the output of below program?

Code:
class base
{
public:
       base()
       {          
           cout<<"BCon";
       }
       ~base()
       {
	   cout<<"BDest ";
       }
};
class derived: public base
{
public:
       derived()
       {     cout<<"DCon ";
       }
       ~derived()
       {     cout<<"DDest ";
       }
};

int main()
{
derived object;
return 0; 
}
  • (A) Dcon DDest
  • (B) Dcon DDest BCon BDest
  • (C) BCon DCon DDest BDest
  • (D) BCon DCon BDes DDest

A

Admin • 833.24K Points
Coach

Q. What is the value of a in below program?

Code:
int main()
{
 int a, b=20;
 a = 90/b;
 return 0;
}
  • (A) 4
  • (B) 4.0
  • (C) 4.5
  • (D) Compilation Error

A

Admin • 833.24K Points
Coach

Q. Which operator has highest precedence?

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

A

Admin • 833.24K Points
Coach

Q. Which operator has highest precedence in * / % ?

  • (A) /
  • (B) %
  • (C) *
  • (D) all have same precedence

A

Admin • 833.24K Points
Coach

Q. How to access and edit data in data file handling using structures

  • (A) write()
  • (B) read()
  • (C) both A and B
  • (D) without read()

A

Admin • 833.24K Points
Coach

Q. What is output of below program?

Code:
int main()
{
  const int a=10;
  a++;
  cout<<a;
return 0;

}
  • (A) 10
  • (B) 11
  • (C) Compilation Error
  • (D) Run time error

A

Admin • 833.24K Points
Coach

Q. How many times mcqbuddy.com is printed?

Code:
int main()
{
    int i=0;
    lbl:
    cout<<"mcqbuddy.com";
    i++;
    if(i<5)
    {
	goto lbl;
    }
return 0;

}
  • (A) 4 times
  • (B) 5 times
  • (C) 6 times
  • (D) 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