FREE! Click here to Join FunTrivia. Thousands of games, quizzes, and lots more!
Quiz about C Trivia
Quiz about C Trivia

C++ Trivia Trivia Quiz


C++ is a programming language developed in Bell Laboratories. This quiz is on the basic elements of a C++ program. I hope you enjoy the quiz.

A multiple-choice quiz by ebanks120. Estimated time: 3 mins.
  1. Home
  2. »
  3. Quizzes
  4. »
  5. Science Trivia
  6. »
  7. Computers
  8. »
  9. Software and Programming

Author
ebanks120
Time
3 mins
Type
Multiple Choice
Quiz #
360,213
Updated
Dec 03 21
# Qns
10
Difficulty
Average
Avg Score
7 / 10
Plays
366
- -
Question 1 of 10
1. A double is classified as what data type? Hint


Question 2 of 10
2. Which of the following is a legal C++ variable name? Hint


Question 3 of 10
3. What is the symbol for the modulus operator?
Hint


Question 4 of 10
4. Which of the following is a string constant? Hint


Question 5 of 10
5. What statement executes one set of statements when true and another when false? Hint


Question 6 of 10
6. What function is automatically called at the beginning of a C++ program? Hint


Question 7 of 10
7. Which loop tests a condition after its iteration? Hint


Question 8 of 10
8. Assuming 78, 57, 65, 54, 89, 49 is an unsorted array, what will the array look like after the first pass when using the selection sort algorithm (you want to sort in ascending order)? Hint


Question 9 of 10
9. By default, how is the memory address of a pointer written when needing to put one in a program? Hint


Question 10 of 10
10. What is the standard file extension for a C++ source code file? Hint



(Optional) Create a Free FunTrivia ID to save the points you are about to earn:

arrow Select a User ID:
arrow Choose a Password:
arrow Your Email:




Quiz Answer Key and Fun Facts
1. A double is classified as what data type?

Answer: A floating point data type

A floating point data type can hold decimal numbers. It can also represent numbers in scientific notation or E notation (E being shorthand for 'times 10 to the power of').
2. Which of the following is a legal C++ variable name?

Answer: exam4_grade

A C++ variable name can only contain letters, numbers and underscores. However, it cannot start with a number or be a C++ keyword.
3. What is the symbol for the modulus operator?

Answer: %

The modulus operator finds the remainder when dividing by two numbers.
4. Which of the following is a string constant?

Answer: "shirt"

A string constant can be a letter of the alphabet, a word, a number, a two word phrase; anything embedded in double quotation marks.
5. What statement executes one set of statements when true and another when false?

Answer: The if/else statement

Here is an example of an if/else statement:

if (num1 > 90)
{
num2 = 57;
}

else
{
num2 = 12;
}

In this statement, either one of the statements will execute depending on user input. For example in this case, if the user enters 327, num2 will be assigned to be 57 since 327 is greater than 90. However, if the user enters 5, num2 will be assigned to be 12 since 5 is less than 90.
6. What function is automatically called at the beginning of a C++ program?

Answer: main()

Function main returns an integer (usually 0) to the operating system at the end of its execution. It also has parameters to accept as arguments passed by value when the program is called by the operating system.
7. Which loop tests a condition after its iteration?

Answer: The do-while loop

The do-while loop will continue to iterate only if the tested condition is true. Otherwise, the loop will stop. The do-while loop is commonly used in menus and when it comes to whether or not a set of choices is to be repeated.
8. Assuming 78, 57, 65, 54, 89, 49 is an unsorted array, what will the array look like after the first pass when using the selection sort algorithm (you want to sort in ascending order)?

Answer: 49, 57, 65, 54, 89, 78

A selection sort algorithm looks for the smallest element in the array and swap positions with the element in subscript 0 (the first element in the array). It then searches for the second smallest element, swaps places with the element in subscript 1 (the second element in the array) and so on and so forth until in ascending order.
9. By default, how is the memory address of a pointer written when needing to put one in a program?

Answer: As a hexadecimal number

A pointer holds the address of the value of the variable assigned to it. The * operator indicates that the variable is a pointer and the & operator obtains the memory address of a variable the pointer points to. An example of a memory address is 0XE5E00.
10. What is the standard file extension for a C++ source code file?

Answer: .cpp

.cpp, of course, stands for C++.
Source: Author ebanks120

This quiz was reviewed by FunTrivia editor WesleyCrusher before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.
Related Quizzes
This quiz is part of series Computer Science Quizzes:

A series of quizzes on computer programming and architecture.

  1. C++ Trivia Average
  2. Assembly Language for the x86 Processor Average
  3. The Science of Computer Technology Average
  4. Unix Is Unique Average
  5. HTML Fundamentals Average
  6. The SQL Database Environment Average

12/22/2024, Copyright 2024 FunTrivia, Inc. - Report an Error / Contact Us