CS102_Fall 2024-2025_Lab3 (1)

studied byStudied by 1 person
0.0(0)
Get a hint
Hint

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

1 / 14

flashcard set

Earn XP

Description and Tags

15 Terms

1

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

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

New cards
2

What is the operator for addition in C++?

The addition operator is +.

New cards
3

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

Expressions in parentheses are evaluated first.

New cards
4

What symbol is used for modulus in C++?

The modulus operator is %.

New cards
5

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

The output is 33.

New cards
6

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

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

New cards
7

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.

New cards
8

What C++ operator checks for equality?

The equality operator is ==.

New cards
9

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.

New cards
10

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

Use the syntax: 'int variableName;'

New cards
11

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.

New cards
12

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

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

New cards
13

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

The code block within the if statement will be executed.

New cards
14

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

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

New cards
15
New cards

Explore top notes

note Note
studied byStudied by 4 people
... ago
5.0(1)
note Note
studied byStudied by 94 people
... ago
5.0(1)
note Note
studied byStudied by 433 people
... ago
5.0(3)
note Note
studied byStudied by 33 people
... ago
5.0(1)
note Note
studied byStudied by 28 people
... ago
5.0(1)
note Note
studied byStudied by 32 people
... ago
5.0(2)
note Note
studied byStudied by 11 people
... ago
5.0(1)
note Note
studied byStudied by 29 people
... ago
5.0(1)

Explore top flashcards

flashcards Flashcard (121)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (84)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 16 people
... ago
5.0(1)
flashcards Flashcard (27)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (83)
studied byStudied by 12 people
... ago
5.0(1)
flashcards Flashcard (53)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (48)
studied byStudied by 50 people
... ago
5.0(1)
flashcards Flashcard (24)
studied byStudied by 16 people
... ago
5.0(1)
robot