Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CMSC 140 FINAL EXAM REVIEW QUESTIONS

Beoordeling
-
Verkocht
-
Pagina's
7
Cijfer
A+
Geüpload op
15-08-2025
Geschreven in
2025/2026

CMSC 140 FINAL EXAM REVIEW QUESTIONS What is the difference in using a increment/decrement operator in postfix or prefix? - Answer -In prefix mode, the value is incremented before used in any expression in the same statement. In postfix mode, the value is incremented after used in any expression in the same statement.

Meer zien Lees minder
Instelling
CMSC 140
Vak
CMSC 140

Voorbeeld van de inhoud

CMSC 140 FINAL EXAM REVIEW QUESTIONS

What does it mean to increment something? What operator is used in C++ to do this? -
Answer -To increment something is to increase its value by 1. The operator in C++ is
the ++ (plus-plus) operator.

What does it mean to decrement something? What operator is used in C++ to do this? -
Answer -To decrement something is to decrease its value by 1. The operator in C++ is
the -- (minus-minus) operator.

What is the difference in using a increment/decrement operator in postfix or prefix? -
Answer -In prefix mode, the value is incremented before used in any expression in the
same statement. In postfix mode, the value is incremented after used in any expression
in the same statement.

What does it mean to find the modulus of something? What operator is used in C++ to
do this? - Answer -To find the modulus is to find the remainder after the division of two
numbers. The operator % is used in C++.

What operator is used in C++ to represent division? - Answer -The / operator is used to
represent division in C++.

What will be the data type of the result of division between two integers? - Answer -The
data type will be an integer.

What will be the result of the expression ? What will be different compared to the
expression 7.? - Answer -3 - it will be different from the second expression, which
is 3.5, since because it is integer division any numbers after the decimal are ignored.

What will the variables 'someNum', 'anotherNum', 'lastNum', and 'aBool' contain after
the execution of the following code?

int someNum = 2, anotherNum = 3, lastNum = 1;
bool aBool;
aBool = !(++someNum > (--anotherNum * lastNum++)); - Answer -someNum: 3
anotherNum: 2
lastNum: 2
abool: false

Name the three different types of loops. - Answer -1. while loop
2. do-while loop
3. for loop

, For each type of loop, state if the loop is pretest or post test, and explain what that
means. - Answer -1. while loop: pretest, which means it will evaluate its expression
before the loop executes once.
2. do-while loop: post test, which means it will evaluate its expression after the loop
executes once
3. for loop: pretest, which means it will evaluate its expression before the loop executes
once.

What are the three parts of a for loop definition called? What do each of them do? -
Answer -The three parts of a for loop definition are initialization, test, and update.

initialization - the counter variable is initialized to a value. It executes once, the first time
the loop executes

test - the expression that evaluates to true or false, which controls the execution of the
loop

update - the expression that updates the counter variable. It executes at the end of each
loop.

What will be displayed on the screen after the execution of the following code?

int counter = 0;
bool moreThan20 = false;

while (!moreThan20)
{
if (counter != 6)
{
cout << counter << endl;
}

if (counter == 14)
{
cout << "...Getting close..." << endl;
}
else if (counter == 18)
{
cout << "...Almost there..." << endl;
}

if (counter > 20)
{
cout << "...It's over twenty..." << endl;
moreThan20 = true;
}

Geschreven voor

Instelling
CMSC 140
Vak
CMSC 140

Documentinformatie

Geüpload op
15 augustus 2025
Aantal pagina's
7
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$13.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
GEEKA YALA UNIVERSITY
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2113
Lid sinds
4 jaar
Aantal volgers
1446
Documenten
55047
Laatst verkocht
2 dagen geleden

3.8

358 beoordelingen

5
177
4
61
3
48
2
17
1
55

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen