100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Overig

Review for UnsortedLists and SortedLists

Beoordeling
-
Verkocht
-
Pagina's
5
Geüpload op
06-11-2025
Geschreven in
2025/2026

The program is a quiz application designed to review concepts related to Unsorted Lists and Sorted Lists. It consists of multiple-choice questions and string input questions, with functionality to evaluate user responses and provide feedback. Key components include: - **Variables**: Used to track user input, correct answers, and scores. - **Functions**: - `checkCharAnswers` and `checkStringAnswers`: Validate single character and string answers. - `counting`: Updates the total score based on correctness. - `charMessage` and `stringMessage`: Provide feedback for individual answers. - `displayResult`: Summarizes the final score and performance. - `question1` through `question10`: Implement the quiz questions. The program guides users through the questions, collects answers, and displays results at the end, aiming to enhance understanding of the covered topics.

Meer zien Lees minder
Instelling
Vak









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
6 november 2025
Aantal pagina's
5
Geschreven in
2025/2026
Type
Overig
Persoon
Onbekend

Onderwerpen

Voorbeeld van de inhoud

#include "UnsortedSorted.h"

int static counter = 0;
int static total = 0;
char input;
char answer;
string typedInput;
string typedAnswer;
bool correct;

bool checkCharAnswers(char input, char answer);
bool checkStringAnswers(string typedInput, string typedAnswer);
void counting(bool correct);
void charMessage(bool correct, char answer);
void stringMessage(bool correct, string typedAnswer);
void displayResult(int counter, int total);

void question1();
void question2();
void question3();
void question4();
void question5();
void question6();
void question7();
void question8();
void question9();
void question10();

int main()
{
cout << "WELCOME to the review for UnsortedLists and SortedLists" << endl;
cout << "If you find any errors or have any ideas to better improve my code,
please let me know. I might not have spent a million hours putting this together."
<< endl << endl;
cout << "NOTE: Be wary that by using strings to hold standard input, whitespace
is also taken into consideration when comparing answers. Always check the outputted
answer when the program claims your answer was 'wrong'" << endl << endl;
question1();
question2();
question3();
question4();
question5();
question6();
question7();

displayResult(counter, total);
}

void question1()
{
answer = 'A';

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "When deleting an item in an unsorted list, what do you have to check
first?" << endl;
cout << "A. if the list is empty" << endl;
cout << "B. if the list is full" << endl;
cout << "C. if the user inputted numbers" << endl;

, cout << "D. if the user provided their name" << endl;

counter++;
cout << "Type the letter for your answer... ";
cin >> input;

correct = checkCharAnswers(input, answer);
counting(correct);
charMessage(correct, answer);
}

void question2()
{
typedAnswer = "midpoint = (first + last)/2;";
string typedAnswer2 = "midpoint = (last + first)/2;";

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "Referring to the binary search discussed in lecture and homework,
there are three variables named: 'first', 'last', and 'midpoint'. Write the math
expression to calculate the midpoint." << endl;
cin.ignore();
cout << "Type your answer (don't forget the semicolon)... ";
getline(cin, typedInput);

counter++;
counting(correct);
if (checkStringAnswers(typedInput, typedAnswer) == true ||
checkStringAnswers(typedInput, typedAnswer2) == true)
{
cout << "Good job" << endl;
correct = true;
}
else
{
correct = false;
stringMessage(correct, typedAnswer);
cout << endl;
cout << "OR" << endl;
cout << endl;
stringMessage(correct, typedAnswer2);
}
}

void question3()
{
answer = 'B';

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "What is the Big O for a binary search of a SortedList list?" << endl;
cout << "A. 0(1)" << endl;
cout << "B. 0(log n)" << endl;
cout << "C. 0(n)" << endl;
cout << "D. 0(ln n)" << endl;

counter++;
cout << "Type the letter for your answer... ";
cin >> input;
€22,55
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
tinahuynh

Maak kennis met de verkoper

Seller avatar
tinahuynh California State University, Long Beach
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
Nieuw op Stuvia
Lid sinds
1 maand
Aantal volgers
0
Documenten
68
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

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

Veelgestelde vragen