C++ Basic MCQ Questions And Answers

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Allcompiler
A
Allcompiler
Community Contributor
Quizzes Created: 4 | Total Attempts: 23,557
| Attempts: 5,459 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Which of the following cannot be used as identifiers?

Explanation

Spaces cannot be used as identifiers because in most programming languages, identifiers are used to represent variables, functions, or other entities in the code. Spaces are not allowed because they can cause ambiguity and confusion in the code. Instead, developers typically use underscores or camel case to separate words within an identifier.

Submit
Please wait...
About This Quiz
C++ Basic MCQ Questions And Answers - Quiz

Get ready for these C++ basic MCQ questions and answers. This quiz is created for those users who want to test their command over the C++ Programming Language.... see moreThe quiz is gonna be helpful to learn even more about C++ in a fun way. You will be called an expert in this subject if you manage to get more than 70 on this quiz. So, are you ready and excited? Let's go for it!


see less

2. The difference between x and 'x' is

Explanation

The correct answer is that the first one refers to a variable whose identifier is x and the second one refers to the character constant x. This means that the first one is a variable that can hold a value, while the second one is a specific character constant.

Submit
3. A variable is/are

Explanation

The correct answer is "A portion of memory to store a determined value". In programming, a variable is a named location in memory that holds a value. It is used to store and manipulate data during program execution. Variables can hold different types of values such as numbers, strings, or boolean values, and their values can change throughout the program. They provide a way to store and access data efficiently, making it easier to work with and manipulate information in a program.

Submit
4. In an assignment statement

Explanation

The correct answer is "All of above". This is because in an assignment statement, the value can be a constant, a variable, an expression, or any combination of these. The assignment always takes place from right to left and never the other way. Therefore, all the statements mentioned in the options are correct.

Submit
5. Regarding the following statement, which of the statements is true?

const int pathwidth=100;

Explanation

The given statement "const int pathwidth=100;" declares a constant variable named pathwidth with an initial value of 100.

Submit
6. Which of the following statement is true?

Explanation

All of the statements given are true. String literals can extend to more than a single line of code by using a backslash at the end of each unfinished line. Multiple string constants can be concatenated by separating them with blank spaces, tabulators, newlines, or any other valid blank character. If we want the string literal to be explicitly made of wide characters, we can use the L prefix. Therefore, the correct answer is "All of above."

Submit
7. Which of the following identifiers is invalid?

Explanation

The identifier "Typename" is invalid because it starts with an uppercase letter, which is not allowed in most programming languages. Identifiers usually start with a lowercase letter or an underscore.

Submit
8. Which of the following cannot be used as a valid identifier?

Explanation

The identifier "bitand" cannot be used as a valid identifier because it is a reserved keyword in many programming languages, including C++, C#, and Java. Reserved keywords have a predefined meaning in the language and cannot be used as identifiers for variables, functions, or other elements in the code. Using "bitand" as an identifier would result in a syntax error.

Submit
9. Which of the following is not a valid escape code?

Explanation

not-available-via-ai

Submit
10. Regarding #difine, which of the following statement is false?

Explanation

The statement "It is a C++ statement that declares a constant in C++" is false. The correct answer is that #define is not a C++ statement but the directive for the preprocessor. #define is used to define constants or macros in C++ and is processed by the preprocessor before the actual compilation of the code. It does not require a semicolon at the end of the line.

Submit
View My Results

Quiz Review Timeline (Updated): Apr 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Apr 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 15, 2011
    Quiz Created by
    Allcompiler
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following cannot be used as identifiers?
The difference between x and 'x' is
A variable is/are
In an assignment statement
Regarding the following statement, which of the statements is true?...
Which of the following statement is true?
Which of the following identifiers is invalid?
Which of the following cannot be used as a valid identifier?
Which of the following is not a valid escape code?
Regarding #difine, which of the following statement is false?
Alert!

Advertisement