CIS170 Solved Final Exam in C++ – Previous Exam – 30 MCQs, 7 Essay Questions – Guaranteed 100% score
1. (TCO 13) Text files are what type of file? (Points : 4)
2. (TCO 13) What do the following statements accomplish?
theFile.open( myFile.txt , ios::in); (Points : 4)
Opens myFile in read mode
Opens myFile in append mode
Creates an empty file named myFile
Opens a file in input mode to write to
3. (TCO 13) When a file is opened in the append mode, the file pointer is positioned _____. (Points : 4)
at the end of the file
at the beginning of the file
in the middle of the file
after the file header
4. (TCO 13) The is_closed function returns what kind of data type? (Points : 4)
5. (TCO 12) Which is not a reason that pointers are valuable? (Points : 4)
Pointers allow for faster access to array elements.
Pointers speed the process of passing objects like classes to functions.
Pointers allow function to be passed as an argument to other functions.
Pointers involve a great deal of overhead when used in conjunction with arguments.
6. (TCO 11) N-1 is the _____. (Points : 4)
first position of an array
position of Row
position of Column
last position of an array
7. (TCO 11) When working with an array, the easiest way to traverse or visit all elements of the array is to _____. (Points : 4)
use a loop statement
sort the array and read it
do a binary search
use sequential coding
8. (TCO 11) In the following array, what is the value of table?
(Points : 4)
9. (TCO 10) To halt the execution of a program at a specific spot during debugging, you must use a _____. (Points : 4)
scope resolution operator
10. (TCO 9) The procedures that the object performs are known as _____. (Points : 4)
11. (TCO 9) The class _____ starts with the word “Class” followed by the name of the class. (Points : 4)
12. (TCO 9) The mutator methods are sometimes called _____. (Points : 4)
None of the above
13. (TCO 9) Which method is called automatically when an object is created? (Points : 4)
14. (TCO 8) A value that is part of a function header is called a(n) _____. (Points : 4)
15. (TCO 7) What is wrong with this call statement?
PrintName(string name); (Points : 4)
It is missing void.
The data type should be removed.
The semicolon should be removed.
Nothing is wrong with it.
1. (TCO 7) A variable’s visibility indicating where in the program the variable can be used is called _____. (Points : 4)
2. (TCO 7) Why is it not necessary to return a variable from a function if the variable is declared as global? (Points : 4)
You have to return all variables regardless of scope.
All functions can see and access global variables.
main() gets copies of global variables.
Each function gets its own copy of global variables.
3. (TCO 6) Debugging is like being a(n) _____. (Points : 4)
4. (TCO 5) Float and double variables should not be used _____. (Points : 4)
to perform mathematical calculations
as approximate representations of decimal numbers
for applications when precision is required
5. (TCO 5) The most difficult aspect of working with _____ loops is keeping track of the separate loop control variables that direct the program’s execution. (Points : 4)
6. (TCO 5) How many times will this for loop execute?
for(int i = 0; i < 10; --i) (Points : 4)
0, the loop will not execute
It is an infinite loop.
7. (TCO 4) Input values should always be checked for _____. (Points : 4)
division by zero if division is taking place
All of the above
8. (TCO 4) Consider the following segment of code.
if(apple = 5)
cout<<"You got \"five\" apples!"<
cout<<"You do not have five apples!\n";
cout<<"The end of the program is reached.";
What error can you identify? (Points : 4)
A double quotation mark was incorrectly inserted.
The programmer forgot the curly braces.
Assumes indentation has a logical purpose
The programmer used assignment operators instead of relational operators.
9. (TCO 4) Why are break statements needed inside a switch's case statements? (Points : 4)
The break statements cause the program to jump out of the switch.
The case label is needed so that the switch finds the correct condition.
The break statements separate the case statements.
None of these statements explain why a switch needs break statements.
10. (TCO 3) What is the value of x after the following statement?
x = 2 * 5 + (3 + 1)/ 5.0 ; (Points : 4)
11. (TCO 2) The endl can be found in which of the following namespaces? (Points : 4)
12. (TCO 2) What does the zero in Return (0) indicate? (Points : 4)
The program has terminated successfully.
The lowest number used was zero.
The program has not terminated successfully.
It serves no purpose and can be omitted.
13. (TCO2) C++ paragraph comments are represented by which characters? (Points : 4)
14. (TCO 1) Which of the following statements about IDE is true? (Points : 4)
IDE provides editing, compiling, and debugging in one software package.
IDE only allows programmers to edit their code.
Visual Studio.Net is not an IDE.
IDE stands for integrated development engine.
15. (TCO 2) The following program displays: _____.
using namespace std;
cout << "We like\"CIS170\"";
(Points : 4)
We like CIS170
We like CIS170c
We like \ CIS170\
We like “CIS170 “
1. (TCO 3) What is the output of the following program?
using namespace std;
int x1, x2, i, j, k, y, z;
x1 = 1;
x2 = 1;
y = 5 + x1–;
z = 5 + ++x2;
i = 6 % 4;
j = 1;
j += j + 3;
k = 25 / 2;
f = (float)((2 / 5) * k);
cout<<"x1 is "<
(Points : 15)
2. (TCO 4) When using a logical AND (or a logical OR), are the expressions to both sides of the && (or ||) always evaluated? Please explain. (Points : 15)
3. (TCO 5) Using a loop, write a program that reads in exactly five integers and outputs the sum. (Points : 15)
4. (TCO 7) In your own words, define a function and code an example of creating a function and calling it. (Points : 15)
5. (TCO 11) Explain how to declare and assign values to a two-dimensional array, and provide a C++ program segment that illustrates your answer. Provide a summary of how the values are stored. (Points : 15)
6. (TCO 9) Explain which is more appropriate for writing a menu program: a switch case or if-else statements. Provide a snippet of code to support your position. (Points : 15)
7. (TCO 13) Create a writeData method snippet of code using NAME and State as variables. Collect the information and write it to file. (Points : 20)
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at firstname.lastname@example.org.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at email@example.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at firstname.lastname@example.org.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.