C++ MCQs with answers Page - 69

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. Which of these won’t return any value?

  • (A) void
  • (B) null
  • (C) free
  • (D) empty

A

Admin • 833.24K Points
Coach

Q. Which function do we use for checking if a character is a space or a tab?

  • (A) isdigit()
  • (B) isblank()
  • (C) isalnum()
  • (D) isalpha()

A

Admin • 833.24K Points
Coach

Q. What would happen in case one uses a void in the passing of an argument?

  • (A) It would return any value
  • (B) It may not or may depend on a declared return type of any function. The return type of the function is different from the passed arguments
  • (C) It would return some value to the caller
  • (D) It would not return any value to the caller

A

Admin • 833.24K Points
Coach

Q. What is the difference between delete and delete[] in C++?

  • (A) delete is used to delete normal objects whereas delete[] is used to pointer objects
  • (B) delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case
  • (C) delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
  • (D) delete is a keyword whereas delete[] is an identifier

A

Admin • 833.24K Points
Coach

Q. What happens if the following program is executed in C and C++?

Code:
#include <stdio.h> 
int main(void) 
{ 
	int new = 5;
	printf("%d", new); 
}
  • (A) Error in C and successful execution in C++
  • (B) Error in C++ and successful execution in C
  • (C) Error in both C and C++
  • (D) A successful run in both C and C++

A

Admin • 833.24K Points
Coach

Q. What happens if the following program is executed in C and C++?

Code:
#include <stdio.h> 
void func(void)
{
	printf("Hello");
}
void main() 
{ 
	func();
	func(2);
}
  • (A) Error in both C and C++
  • (B) Error in C++ and successful execution in C
  • (C) Error in C and successful execution in C++
  • (D) Outputs Hello twice in both C and C++

A

Admin • 833.24K Points
Coach

Q. Which of the following is correct about this pointer in C++?

  • (A) this pointer is passed as a hidden argument in all static variables of a class
  • (B) this pointer is passed as a hidden argument in all non-static functions of a class
  • (C) this pointer is passed as a hidden argument in all the functions of a class
  • (D) this pointer is passed as a hidden argument in all static functions of a class

A

Admin • 833.24K Points
Coach

Q. __________ is an ability of grouping certain lines of code that we need to include in our program?

  • (A) macros
  • (B) modularization
  • (C) program control
  • (D) specific task

A

Admin • 833.24K Points
Coach

Q. Which of these keywords do we use for the declaration of the friend function?

  • (A) myfriend
  • (B) classfriend
  • (C) friend
  • (D) firend

A

Admin • 833.24K Points
Coach

Q. What is used for dereferencing?

  • (A) pointer with asterix
  • (B) pointer without asterix
  • (C) value with asterix
  • (D) value without asterix

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