C++ Programming Quiz 1

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 Tcarteronw
T
Tcarteronw
Community Contributor
Quizzes Created: 37 | Total Attempts: 31,078
Questions: 18 | Attempts: 566

SettingsSettingsSettings
C++ Programming Quiz 1 - Quiz

C++ is a general purpose programming language with imperative, object oriented and generic programming features. If you just started on this language and wish to get some practice material to test your understanding, take up the quick C++ programming quiz 1 below and keep an eye out for more. Good luck!


Questions and Answers
  • 1. 

    Who was the programmer for Charles Babbage’s analytical engine?

    • A.

      Grace Hopper

    • B.

      Ada Lovelace

    • C.

      Lord Bryan

    • D.

      Walter Savitch

    Correct Answer
    B. Ada Lovelace
    Explanation
    Ada Lovelace was the programmer for Charles Babbage's analytical engine. Ada Lovelace is often considered the world's first computer programmer, as she wrote the first algorithm designed to be processed by a machine. She worked closely with Charles Babbage and made significant contributions to the development of the analytical engine, including creating a plan for how the machine could calculate Bernoulli numbers. Lovelace's work laid the foundation for modern computer programming and her contributions are still celebrated today.

    Rate this question:

  • 2. 

    An algorithm is

    • A.

      The inputs and outputs of a program

    • B.

      The part of the computer that does the processing

    • C.

      A finite set of steps to solve a problem

    • D.

      A complete computer program

    Correct Answer
    C. A finite set of steps to solve a problem
    Explanation
    The correct answer is "A finite set of steps to solve a problem." An algorithm is a step-by-step procedure or a set of instructions that outlines how to solve a specific problem or complete a specific task. It is a systematic approach to problem-solving that provides a clear and logical sequence of actions to achieve the desired outcome. Algorithms can be implemented in various programming languages to create computer programs, but they are not the same as a complete computer program, which typically includes additional components such as input/output handling, user interfaces, and error handling.

    Rate this question:

  • 3. 

    A memory address is

    • A.

      Where a variable is stored

    • B.

      Where the computer is located

    • C.

      A step in the program.

    • D.

      Where the CPU is stored.

    Correct Answer
    A. Where a variable is stored
    Explanation
    A memory address refers to the specific location in the computer's memory where a variable is stored. It is a unique identifier that allows the computer to access and retrieve the value of the variable when needed. The memory address is crucial for the efficient functioning of a program as it enables the computer to manage and manipulate data effectively.

    Rate this question:

  • 4. 

    Which of the following is not part of the Software Life Cycle?

    • A.

      Analysis

    • B.

      Design

    • C.

      Data Entry

    • D.

      Implementation

    • E.

      Testing

    Correct Answer
    C. Data Entry
    Explanation
    Data Entry is not part of the Software Life Cycle because it refers to the process of inputting data into a computer system, which is not a specific phase or activity in the software development process. The Software Life Cycle typically includes phases such as Analysis, Design, Implementation, and Testing, which are essential steps in developing and delivering software. Data Entry, on the other hand, is a separate task that may be required during the operation or usage of a software system, but it is not directly related to the software development life cycle.

    Rate this question:

  • 5. 

    What does the following line of code display to the screen? cout <<  “This is the computer\n programming book\n”;

    • A.

      This is the computer programming book

    • B.

      This is the computer

    • C.

      Nothing

    • D.

      This is the computer programming book

    Correct Answer
    D. This is the computer programming book
    Explanation
    The given line of code uses the cout object to display the string "This is the computer programming book" to the screen.

    Rate this question:

  • 6. 

    C++ statements end with a

    • A.

      Period

    • B.

      Comma

    • C.

      Semicolon

    • D.

      Nothing

    Correct Answer
    C. Semicolon
    Explanation
    C++ statements end with a semicolon. In C++, the semicolon is used to mark the end of a statement. It is a punctuation mark that indicates to the compiler that the statement has been completed. Omitting the semicolon at the end of a statement will result in a compilation error. Therefore, to ensure proper syntax and compilation of C++ code, it is necessary to end statements with a semicolon.

    Rate this question:

  • 7. 

    Which of the following is not an example of a program bug?

    • A.

      Run-time error

    • B.

      Operator error

    • C.

      Syntax error

    • D.

      Logic error

    Correct Answer
    B. Operator error
    Explanation
    An operator error is not an example of a program bug because it is a mistake made by the user while interacting with the program, rather than a flaw or mistake within the program's code itself. Program bugs refer to errors or flaws in the code that cause unintended or incorrect behavior, whereas operator errors occur when the user inputs incorrect or inappropriate data or commands.

    Rate this question:

  • 8. 

    The output of the compiler is called

    • A.

      The program

    • B.

      Source code

    • C.

      Linked code

    • D.

      Object code

    Correct Answer
    D. Object code
    Explanation
    Object code refers to the output of a compiler after it has translated the source code into a form that can be executed by a computer. It consists of machine code instructions that can be directly executed by the computer's processor. Object code is typically in binary form and is specific to the target hardware and operating system. It is the final step in the compilation process before the program can be run.

    Rate this question:

  • 9. 

    A finite sequence of  precise instructions that leads to a problem solution is

    • A.

      A program

    • B.

      The CPU

    • C.

      A List of Inputs and Outputs

    • D.

      An Algorithm

    Correct Answer
    D. An Algorithm
    Explanation
    An algorithm is a finite sequence of precise instructions that leads to a problem solution. It is a step-by-step procedure that can be followed to solve a specific problem. Algorithms can be implemented in various ways, such as through programming languages, but the concept of an algorithm is independent of any specific programming language or computer hardware. Therefore, an algorithm is the correct answer in this context.

    Rate this question:

  • 10. 

    Int number;

    • A.

      Is an output statement

    • B.

      Is an input statement

    • C.

      Is a variable declaration

    • D.

      Is a program

    Correct Answer
    C. Is a variable declaration
    Explanation
    The given statement "int number;" is a variable declaration. In programming, the "int" keyword is used to declare a variable of integer type, and "number" is the name given to the variable. This statement is not an output or input statement, as it does not involve any data being displayed or accepted. It is also not a complete program, as it is just a single line of code.

    Rate this question:

  • 11. 

    Cout << “How many items would you want?\n”;

    • A.

      Is an output statement

    • B.

      Is an input statement

    • C.

      Is a variable declaration

    • D.

      Is a program

    Correct Answer
    A. Is an output statement
    Explanation
    The given code snippet "cout

    Rate this question:

  • 12. 

    Cin >> number;

    • A.

      Is an output statement

    • B.

      Is an input statement

    • C.

      Is a variable declaration

    • D.

      Is a program

    Correct Answer
    B. Is an input statement
    Explanation
    The given statement "cin >> number;" is an input statement. It is used to take input from the user and store it in the variable "number". The "cin" is an object of the input stream class, and the ">>" operator is used to extract the input from the user and assign it to the variable. Therefore, this statement is used for input operations in a program.

    Rate this question:

  • 13. 

    #include <iostream>

    • A.

      Is a variable declaration

    • B.

      An executable statement

    • C.

      An include directive

    • D.

      Illegal code

    Correct Answer
    C. An include directive
    Explanation
    The given correct answer is "an include directive". In C++, the "#include " statement is used to include the iostream library, which allows the program to use input and output streams. It is not a variable declaration or an executable statement, but rather a directive that tells the compiler to include a specific library. Therefore, the correct answer is an include directive.

    Rate this question:

  • 14. 

    What is wrong with the following statement? cout  << “Hello to everyone\n;

    • A.

      Cout should be count

    • B.

      Missing a semicolon

    • C.

      Missing a “

    • D.

      Missing a (

    Correct Answer
    C. Missing a “
    Explanation
    The given statement is missing a closing quotation mark.

    Rate this question:

  • 15. 

    C++ is an example of a

    • A.

      Machine language

    • B.

      High-level language

    • C.

      Low-level language

    • D.

      Assembly language

    Correct Answer
    B. High-level language
    Explanation
    C++ is considered a high-level language because it provides a level of abstraction from the underlying hardware and allows programmers to write code that is closer to human language. It includes features like object-oriented programming, dynamic memory allocation, and a rich library that makes it easier to develop complex applications. High-level languages are designed to be user-friendly and focus on readability and ease of use, making them more accessible to programmers compared to low-level languages like machine language or assembly language.

    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
  • May 21, 2013
    Quiz Created by
    Tcarteronw
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.