CS102_Fall 2024-2025_Lab3 (1)

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

What is the purpose of binary arithmetic operators in C++?

To perform mathematical operations such as addition, subtraction, multiplication, and division.

2
New cards

What is the operator for addition in C++?

The addition operator is +.

3
New cards

What is the order of evaluation when parentheses are used in expressions?

Expressions in parentheses are evaluated first.

4
New cards

What symbol is used for modulus in C++?

The modulus operator is %.

5
New cards

What output does the statement 'cout << x + 9 / 3;' produce when x is 30?

The output is 33.

6
New cards

How do you read multiple integers from user input in C++?

Use cin followed by the variable names, e.g., cin >> number1 >> number2 >> number3.

7
New cards

In a decision-making statement, what will be printed if 'a' equals 'b'?

It will print the content within the if block, which can include multiple cout statements.

8
New cards

What C++ operator checks for equality?

The equality operator is ==.

9
New cards

What is the output for the program that checks if a number is positive?

It will print 'You entered a positive integer' if the number is greater than zero.

10
New cards

How do you declare a variable to store a number in C++?

Use the syntax: 'int variableName;'

11
New cards

What is the resulting output of the program if user inputs three integers 13, 27, 14?

Sum is 54, Average is 18, Product is 4914.

12
New cards

What will the program output if a user inputs -5 for the variable 'number'?

It will display 'You entered a negative integer: -5'.

13
New cards

What happens in C++ if a variable condition is true?

The code block within the if statement will be executed.

14
New cards

How do you calculate the total cost with a discount in C++?

Check if the price exceeds 1000 and apply 10% discount if true.

15
New cards