Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Exam Review | Computer Science I | CS 155, Study notes of Computer Science

CS 155 Exam Review Material Type: Notes; Professor: Jenkins; Class: Computer Science I; Subject: Computer Science; University: University of North Alabama; Term: Spring 2011;

Typology: Study notes

2010/2011

Uploaded on 02/14/2011

officejesus1
officejesus1 🇺🇸

2 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 155 – Exam Review
Name __________________________________
General Question – 25 points (5 points each):
1. The extraction operator (>>) is used for input and it skips ___________________when inputting values.
2. A 4-bit memory location can store unique values.
3. Define Algorithm.
4. A data type that we have used that is not part of the original C++ language is the
data type.
5. Are the following Boolean expressions equivalent? Circle YES or NO
!(A && B)
B && !A
Tracing One – Predict the output of the following code as it would appear on the screen – 25 points.
#include <iostream>
using namespace std;
int main(){
int a = 2, b = 4, c = 6, d = 5;
double e = 5.0;
cout << "PROB1: " << a + b / d << endl;
cout << "PROB2: " << a + b / e << endl;
cout << "PROB3: " << d + a * c % b << endl;
cout << "PROB4: " << a + b++ << endl;
cout << "PROB5: " << b << endl;
return 0;
}
Show output below:
pf3
pf4

Partial preview of the text

Download Exam Review | Computer Science I | CS 155 and more Study notes Computer Science in PDF only on Docsity!

Name __________________________________

General Question – 25 points (5 points each):

  1. The extraction operator (>>) is used for input and it skips ___________________when inputting values.
  2. A 4-bit memory location can store unique values.
  3. Define Algorithm.
  4. A data type that we have used that is not part of the original C++ language is the data type.
  5. Are the following Boolean expressions equivalent? Circle YES or NO !(A && B) B && !A

Tracing One – Predict the output of the following code as it would appear on the screen – 25 points. #include using namespace std;

int main(){ int a = 2, b = 4, c = 6, d = 5; double e = 5.0;

cout << "PROB1: " << a + b / d << endl; cout << "PROB2: " << a + b / e << endl; cout << "PROB3: " << d + a * c % b << endl; cout << "PROB4: " << a + b++ << endl; cout << "PROB5: " << b << endl;

return 0; } Show output below:

Name __________________________________

Tracing Two – Predict the output of the following code as it would appear on the screen – 25 points. #include using namespace std;

int main(){ int x = 2; int res1 = 0; while (x < 12){ res1 = res1 + x; cout << "res1: " << res1 << endl; x = x * 2; } cout << "x: " << x << endl;

cout << "***********" << endl; int i = 1; int j;

int res2 = 0; while (i < 4){ j = 1; res2 = 0; while ( j < 5){ res2 = i * j; cout << res2 << " "; j++; } cout << endl; i++; }

return 0; } Show output below:

Name __________________________________

Coding Two– Write the entire program for the problem presented – 25 points.

Write a program that asks the user for a list of grades to be averaged. Ask for grades until the user enters a value less than 0 or greater than 100. The invalid entry should not be included in the average. Be sure to include descriptive prompts for input and descriptive explanations for output.

Sample Input: 90 91 100 80 75 - Sample Output: The average of 5 grades is: 87.

Neatly write your entire program: