CS 1 Final Exam Review Mr Crone Convert















































- Slides: 47
CS 1 Final Exam Review Mr. Crone
Convert 101101 from binary to decimal.
Convert 101101 from binary to decimal. 101101 Base 2 = 45 Base 10
Convert 78 from Base 10 to Base 2.
Convert 78 from Base 10 to Base 2. 78 Base 10 = 1001110 Base 2
Is C++ considered a high-level or low level programming language?
Is C++ considered a high-level or low level programming language? High-Level
Is C++ object oriented or procedural based?
Is C++ object oriented or procedural based? Object Oriented
How many bits are in 3 bytes?
How many bits are in 3 bytes? 24 bits in 3 bytes
ASCII and Unicode are used to convert binary into…
ASCII and Unicode are used to convert binary into letters, numbers, and symbols.
Software can be broken down into two types: ____ and _____ software.
Software can be broken down into two types: system and application software.
Which of the operators below has the highest precedence? &&, ||, !
Which of the operators below has the highest precedence? &&, ||, ! ! has the highest precedence
Which of the operators below has the highest precedence? &&, ||
Which of the operators below has the highest precedence? &&, || && has the highest precedence
What does the code below print? cout << double(5)/4 << endl;
What does the code below print? cout << double(5)/4 << endl; // Prints: 1. 25
What does the code below print? cout << double(5/4) << endl;
What does the code below print? cout << double(5/4) << endl; // Prints: 1
What does the code below print? int var 1 = 4, var 2 = 3; const var 3 = 15; cout << var 1 + var 2 + var 3 <<< endl;
What does the code below print? int var 1 = 4, var 2 = 3; const var 3 = 15; // ERROR! cout << var 1 + var 2 + var 3 <<< endl;
What is the assignment operator?
What is the assignment operator? =
Name the relational operators.
Name the relational operators. <, >, <=, >=, ==, !=
Name the logical operators.
Name the logical operators. &&, !, ||
Name the increment and decrement operators.
Name the increment and decrement operators. ++, --
Name the shortcut assignment operators.
Name the shortcut assignment operators. +=, -=, *=, /=, %=
Which of the operators below has the highest precedence? -, +, %
Which of the operators below has the highest precedence? % (Modulus)
The code below creates a random number in what range? int r 1 = rand() % 10 + 4
The code below creates a random number in what range? int r 1 = rand() % 10 + 4 [4, 13]
Provide two examples of escape sequences.
Provide two examples of escape sequences. n, t
What does the code below print? cout << int(3. 7) << endl;
What does the code below print? cout << int(3. 7) << endl; // 3
What does the code below print? string str = “Northern Pike”; cout << str. at(6) << endl;
What does the code below print? string str = “Northern Pike”; cout << str. at(6) << endl; //Prints: r
What does the code below print? string str = “Northern Pike”; cout << str. find(“the”) << endl;
What does the code below print? string str = “Northern Pike”; cout << str. find(“the”) << endl; //Prints: 3