CS 115 Midterm Exam Review
1-) Explain the following concepts briefly?
a. #include <iostream>
- Tells the preprocessor to include the iostream standard file. This specific file (iostream)
includes the declarations of the basic standard input-output librar
CS-115 Final Examination
What is printed by each of the following code fragments?
for(int i = 1; i < 100; i *= 2)
cout < i < ' ';
int a = 0;
if(a > 0 & a = 2) cout < a; else cout < a + 1;
int a = 0;
If(a > 0 | a = 2) cout < a; else cout < a
CONSOLE APPLICATION : HwCh5 Project Overview
AppWizard has created this HwCh5 application for you.
This file contains a summary of what you will find in each of the files that
make up your HwCh5 application.
This is the main project fi
After researching about C+ programming jobs, I have found that there are plenty of jobs
for a C+ programmer. A C+ programmer is quite flexible if one is looking for a job because a
lot of engineering companies are looking for C+ programmers. Enginee
/ Exercise 4.cpp : Defines the entry point for the console application.
using namespace std;
int _tmain(int argc, _TCHAR* argv)
int num1, num2;
cout < "please input two numbers: ";
cin > num1 > num2;
January 25, 2015
History of Programming Languages
Did you know that the first programming language is over 100 years old and was written be a
woman, Ada Lovelace? For 100 years, computer programmers have been writing code. Now
there are more than 2
1. State True/False
1. The if, while and for statements control only one statement. -TRUE
a. The one statement may be a block (statements that are enclosed with curly
braces cfw_) or a single line.
2. Given the declaration:
int x = 0;
The following expres
1. Do a research on the Internet about jobs for C+ programs and what is the salary range for a
C+ programmer. Submit your findings in 200 words using a word document.
There are many occupations that exist for C+ programmers. Among them are
the roles of So
#include <iostream> o #include allows C+ to make some facilities in some code available to us when
writing our code
o <iostream> - C+ standard library; allows us to use input or output data from
user into our code. Piece them toge
1. c) A static member.
2. d) A class can have only one default constructor.
a) The following is a partial definition of class Time:
Programming Assignment 6:
Write two functions, total_minutes() takes two integer parameters,
a time in hours and minutes, and returns the total number of minutes, so total_minutes(2, 15)
returns 135. The second function hours_minutes() takes three para
CS 115 Midterm Eamination
What is printed by each of the following? (12 points)
a. cout < 1/2;
b. cout < 4/2*3;
c. cout < 3.0/2*3; _4.5_
d. cout < 3/2*3.0; _3.0_
2) What is the value of x after each of the following s
Programming Assignment 3:
Write a program that uses a while loop to read in test scores until the user enters a negative number.
Print the average score after dropping the highest and lowest scores.
Print an error message if the user enters less t
CS 115 Programming Assignment 1:
Due at beginning of lab next week (9/22 or 9/23).
Write a C+ program that prompts the user to enter an amount of money
in whole dollars (so this number will be an integer).
The program then prints out how many bills of eac
Programming Assignment 2:
Write a program that prompts the user for two inputs, a unit price and a quantity.
The program then computes the cost of the order as unit price * quantity, with a discount 5%
for orders of 10 or more, and 10% on orders of 100
Programming Assignment 5:
Write a function named mtbf hat takes two input parameters, a double array of MTBF
(Mean Time Between Failures) values for a collection of sub-systems, and an integer
that is the number of sub-systems. The function returns the
Programming Assignment 7:
This will be very similar to the last program. Instead of hours/minutes,
we will use feet/inches. Implement two functions,
int all_inches(int f, int i)
takes two parameters representing a length in feet and inches, and returns
Programming Assignment 4:
Take the code for assignment 3 (you can use either the while or for loop version) and put it in
a function named find_average() that computes the average and returns the result as a double.
The function can read values from the
Define a method hypotenuse that calculates the length of the hypotenuse of a right
triangle when the lengths of the other two sides are given. The method should take
two arguments of type double and return the hypotenuse as a double. Incorporate this
Please note that the examples provided for each of the problems (with far less complicated code) are included in the
1. Write a program to find the larger of 2 numbers and print it on the screen. The user should
input the two numbers.
1. Write a method integerPower( base, exponent ) that returns the value of base exponent.
a) For example, integerPower( 3, 4 ) calculates 34 (or 3 * 3 * 3 * 3).
b) Assume that the exponent is a positive, nonzero integer and that the base is an integer.
1. (SavingsAccount Class)
a) Create a SavingsAccount class. Use a static data member annualInterestRate to store
the annual interest rate for each of the savers. Each member of the class contains a
private data member savingsBalance indicating the amount
Monday, March 2, 2015, 1:37 PM
Monday, March 2, 2015, 1:56 PM
18 mins 45 secs
9.00 out of 10.00 (90%)
End-of-line comments that should be ignored by the compiler are denoted using the two
Test 1b Free Response
1. (Duplicate Elimination) Use a one-dimensional array to solve the following problem: Write
an application that inputs twenty integers, each between 10 and 100, inclusive. As each
number is read, enter it in to the array only if it
CHAPTER 3 & 4 PARAMETER, SCOPE AND OVERLOADING
In this chapter, you will learn about: void functions Difference between value and reference parameters Explore reference parameters and valuereturning functions Scope of an identifier Difference b
CHAPTER 3 FUNCTION BASICS
In this chapter, you will: Learn about standard (predefined) functions Learn about user-defined functions Construct value-returning functions, including actual and formal parameters
Functions are like building blocks.
Chapter 2 Flow of Control (Selection)
3 ways to program execution:
Sequentially Selectively by making a choice Repetitively in a loop
Control Structures are used to alter the sequential flow of execution either by selectio