Lesson 4 Variables and Arithmetic Operations
Quiz
•
Engineering
•
12th Grade
•
Hard
IKHTIARUDDIN IKHWAN
Used 3+ times
FREE Resource
Enhance your content in a minute
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What must be declared for all variable names in C++?
Only the type
Variable name and type
Variable name and value
Only the variable name
Answer explanation
In C++, every variable must be declared with both a name and a type. The type specifies what kind of data the variable can hold, while the name is how you reference it in your code. Therefore, the correct answer is 'Variable name and type'.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a valid first character for a variable name?
A
1
a
_
Answer explanation
In variable naming, the first character must be a letter (A-Z, a-z) or an underscore (_). The choice '1' is invalid because it starts with a digit, which is not allowed for variable names.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the assignment operator in C++?
To print a value
To declare a variable
To store a value in a variable
To compare two values
Answer explanation
The assignment operator in C++ is used to store a value in a variable. It assigns the value on the right side to the variable on the left side, making 'To store a value in a variable' the correct choice.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which keyword is used to declare a constant variable?
immutable
static
const
final
Answer explanation
The keyword 'const' is used to declare a constant variable in many programming languages, ensuring that its value cannot be changed after initialization. Other options like 'immutable', 'static', and 'final' serve different purposes.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the setw() manipulator do in C++?
Sets the precision of floating-point numbers
Changes the output format
Fills empty spaces with a character
Sets the field width for output
Answer explanation
The setw() manipulator in C++ sets the field width for output, allowing you to specify how many characters wide the next output field should be. This helps in formatting the output neatly.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which data type is used for decimal numbers in C++?
int
string
float
char
Answer explanation
In C++, the 'float' data type is specifically designed to represent decimal numbers. The 'int' type is for integers, 'string' for text, and 'char' for single characters, making 'float' the correct choice for decimals.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the maximum precision of a double data type?
19 decimal points
15 decimal points
10 decimal points
6 decimal points
Answer explanation
The maximum precision of a double data type is 15 decimal points. This means it can accurately represent numbers with up to 15 digits after the decimal, making '15 decimal points' the correct choice.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
15 questions
Rectifiers and AC Controllers
Quiz
•
University
15 questions
Quiz Workshop Proteus 2025
Quiz
•
University
10 questions
Teste AP2 - Tec 1
Quiz
•
University
16 questions
Marco Legal de las Organizaciones
Quiz
•
University
10 questions
Blockchain for Accelerated Processing of Supply Chain
Quiz
•
University
10 questions
BLOQUE BPLOGS
Quiz
•
University
15 questions
Electric Drives and Traction Quiz
Quiz
•
University
15 questions
Quiz on Safety and Design
Quiz
•
9th Grade - University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Engineering
20 questions
Halloween movies trivia
Quiz
•
7th - 12th Grade
15 questions
Halloween Characters
Quiz
•
7th - 12th Grade
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
11 questions
Halloween Trivia #2
Quiz
•
12th Grade
14 questions
Halloween Fun
Quiz
•
2nd - 12th Grade
8 questions
Veterans Day Quiz
Quiz
•
12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
21 questions
Halloween & Math
Quiz
•
8th - 12th Grade
