C/C++ Programming Language - Set 4

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Mcqquestions
M
Mcqquestions
Community Contributor
Quizzes Created: 23 | Total Attempts: 616,889
Questions: 10 | Attempts: 5,980

SettingsSettingsSettings
C/C++ Programming Language - Set 4 - Quiz

Online MCQ Quiz on C/C++ Programming - Set 4 No. Of Questions:- 10 Time:- 10 Minutes Full Mark:- 100 Pass Mark:- 70 This Quiz is for those user who wants to test their knowledge/skill in C/C++ Programming Language. For more MCQ Questions and Online Quizzes please visit https://www. McqQuestions. Com


Questions and Answers
  • 1. 

    Which of the following function that must contain in all C++ programs?

    • A.

      Start ( )

    • B.

      System ( )

    • C.

      Main ( )

    • D.

      Program ( )

    Correct Answer
    C. Main ( )
    Explanation
    The main() function is a required function in all C++ programs. It serves as the entry point of the program, where the execution begins. Without the main() function, the program will not run or produce any output. Therefore, the main() function must be present in all C++ programs.

    Rate this question:

  • 2. 

    What punctuation must use to end the code C/C++ expression statement?

    • A.

      . (dot)

    • B.

      ; (semi-colon)

    • C.

      : (colon)

    • D.

      ‘ (single quote)

    Correct Answer
    B. ; (semi-colon)
    Explanation
    In C/C++ programming, a semi-colon (;) must be used to end a code expression statement. This punctuation marks the end of a statement and allows the compiler to understand the boundaries of each expression. Not using a semi-colon can result in a syntax error and the code may not compile correctly.

    Rate this question:

  • 3. 

    What symbol must use to signal the begaining and ending of code blocks or compound statements?

    • A.

      { }

    • B.

      -> and

    • C.

      BEGIN and END

    • D.

      ( and )

    Correct Answer
    A. { }
    Explanation
    The symbols { } must be used to signal the beginning and ending of code blocks or compound statements. These curly brackets are commonly used in programming languages like C, C++, Java, and JavaScript to enclose a group of statements and define the scope of the code block. The opening curly bracket { marks the start of the block, and the closing curly bracket } indicates the end of the block.

    Rate this question:

  • 4. 

    Which of the following is a correct comment for comment in C programs?

    • A.

      */ Comments */

    • B.

      ** Comment **

    • C.

      /* Comment */

    • D.

      { Comment }

    Correct Answer
    C. /* Comment */
    Explanation
    The correct comment for commenting in C programs is /* Comment */. This is the standard way to write comments in C programming language. Comments are used to add explanatory notes to the code, which are ignored by the compiler. They help in making the code more readable and understandable for other programmers who may work on the code in the future.

    Rate this question:

  • 5. 

    What value will return to the operating system upon the successful completion of a program?

    • A.

      - 1

    • B.

      1

    • C.

      0

    • D.

      Programs do not return a value

    Correct Answer
    C. 0
    Explanation
    Upon the successful completion of a program, a value of 0 will return to the operating system. This is a common convention in programming where a return value of 0 indicates that the program executed successfully without any errors or issues.

    Rate this question:

  • 6. 

    Which one of the following is the correct operator to compare two variables?

    • A.

      : =

    • B.

      =

    • C.

      Equal

    • D.

      = =

    Correct Answer
    D. = =
    Explanation
    The correct operator to compare two variables is "==" in most programming languages. This operator checks if the values of the two variables are equal. The "==" operator returns true if the values are equal and false otherwise.

    Rate this question:

  • 7. 

    Which one of the following is not a correct variable type in C++ programs?

    • A.

      Float

    • B.

      Real

    • C.

      Int

    • D.

      Double

    Correct Answer
    B. Real
  • 8. 

    The directives for the preprocessors begin with

    • A.

      Ampersand symbol (&)

    • B.

      Two Slashes (//)

    • C.

      Number Sign (#)

    • D.

      Less than symbol (

    Correct Answer
    C. Number Sign (#)
    Explanation
    The correct answer is the number sign (#). Preprocessor directives in programming languages, such as C or C++, typically start with a number sign (#). These directives are used to provide instructions to the preprocessor, which is a program that runs before the actual compilation of the code. The preprocessor performs tasks like including header files, defining constants, and performing conditional compilation. Therefore, the number sign is the correct symbol to indicate the beginning of a preprocessor directive.

    Rate this question:

  • 9. 

    The header file iostream includes

    • A.

      The declarations of the basic standard input-output library.

    • B.

      The streams of includes and outputs of program effect.

    • C.

      Both

    • D.

      None

    Correct Answer
    A. The declarations of the basic standard input-output library.
    Explanation
    The header file iostream includes the declarations of the basic standard input-output library. This means that when we include the iostream header file in our program, we gain access to the basic input and output functionalities provided by the C++ standard library. This includes features such as reading input from the keyboard and printing output to the console.

    Rate this question:

  • 10. 

    Which one of the following is the boolean operator for logical and?

    • A.

      &

    • B.

      & &

    • C.

      |

    • D.

      | &

    Correct Answer
    B. & &
    Explanation
    The boolean operator for logical and is represented by the symbol "&". This operator is used to combine two or more conditions in a logical statement, and it returns true only if all the conditions are true.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Feb 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 22, 2012
    Quiz Created by
    Mcqquestions
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.