Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Programming Fundamentals I Cheat Sheet

by ghostrogue via cheatography.com/23817/cs/5332/

CH 1 CH 1 (cont) CH 1 (cont)

The basic commands that a computer T To develop a program to solve a T ____ represent inform​ation with a Digital
performs are input (get data), output problem, you start by analyzing sequence of 0s and 1s. Signals
(display result), storage, and perfor​mance the problem.
A sequence of eight bits is called byte
of arithmetic and logical operat​ions.
C++ programs have always been F a ____.
Main memory is directly connected to the T portable from one compiler to
The digit 0 or 1 is called a binary bit
CPU. another.
digit, or ____.
When the computer is turned off, everything F Several categories of computers mainframe,
The term GB refers to ___ gigabyte
in secondary memory is lost. exist, such as ____. midsize,
____ consists of 65,536 Unicode
and micro
The devices that feed data and programs F charac​ters.
into computers are called output devices. The basic commands that a input,
A program called a(n) ____ compiler
computer performs are ____, output,
Inform​ation stored in main memory must be T translates instru​ctions written in
transf​erred to some other device for and perfor​mance of arithmetic storage
high-level languages into machine
permanent storage. and logical operat​ions.
code.
Main memory is called ____. random
The device that stores inform​ation F A program called a(n) ____ linker
access
perman​ently (unless the device becomes combines the object program with
unusable or you change the inform​ation by memoryq
the programs from libraries.
rewriting it) is called primary storage. The ____ is the brain of the CPU
A program that loads an loader
The command that does the linking on F computer and the single most
executable program into main
expensive piece of hardware in
Visual C++ 2012 Express and Visual memory is called a(n) ____.
your personal computer.
Studio 2012 is Make or Remake.
A step-b​y-step proble​m-s​olving algorithim
Main memory is an ordered memory
When you compile your program, the F process in which a solution is
compiler identifies the logic errors and sequence of items, called ____. cells
arrived at in a finite amount of time
suggests how to correct them. The devices that feed data and input
is called a(n) ____.
programs into computers are
Dividing a problem into smaller structured
called ____ devices.
subpro​blems is called ____
The devices that the computer output design.
uses to display results are called
A(n) ____ consists of data and the object
____ devices.
operations on those data.
____ programs perform a Applic​ation
specific task.

The ____ monitors the overall operating


activity of the computer and system
provides services.

By ghostrogue Published 6th October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/ghostrogue/ Last updated 6th October, 2015. Learn to solve cryptic crosswords!
Page 1 of 5. http://crosswordcheats.com
Programming Fundamentals I Cheat Sheet
by ghostrogue via cheatography.com/23817/cs/5332/

CH 1 (cont) CH 2. (cont) CH 2. (cont)

The progra​mming language C++ evolved C A comma is also called a F The expression static​_ca​st(6.9) + 13
from ____. statement termin​ator. static​_ca​st(7.9) evaluates to ____.

Suppose that sum is an int T The length of the string "​com​puter 16


CH 2. variable. The statement sum += scienc​e" is ____. Question 22
7; is equivalent to the statement options:
The memory allocated for a float value is four
sum = sum + 7; In a C++ program, one and two are one =
____ bytes.
The ____ rules of a Syntax double variables and input values are 10.5,
In C++, reserved words are the same as F
progra​mming language tell you 10.5 and 30.6. After the statement cin two =
predefined identi​fiers.
which statements are legal, or >> one >> two; executes, ____. 30.6
The maximum number of signif​icant T
accepted by the progra​mming
Suppose that count is an int variable 2
digits in values of the double type is 15.
language. and count = 1. After the statement
The maximum number of signif​icant T Which of the following is a char count++; executes, the value of count
digits in float values is up to 6 or 7. reserved word in C++? is ____.
An operator that has only one operand F Which of the following is a legal program_1 Choose the output of the following Sunny
is called a unique operator. identi​fier? C++ statement: cout << "​Sunny " << Day
If a C++ arithmetic expression has no T '\n' << "Day " << endl;
____ is a valid int value. 46259
parent​heses, operators are evaluated
____ is a valid char value. 'A' Which of the following is the newline \n
from left to right. character?
An example of a floating point double
A mixed arithmetic expression contains F
data type is ____ ____ are executable statements that prompt
all operands of the same type.
inform the user what to do. lines
(2X) The value of the expression 3
Suppose a = 5. After the execution of the T The declar​ation int a, b, c; is int
33/10, assuming both values are
statement ++a; the value of a is 6. equivalent to which of the following? a,b,c;
integral data types, is ____. //
The escape sequence \r moves the F The value of the expression 17 %
insertion point to the beginning of the 7 is ____.
next line.
The expression static​_ca​st(9.9) 9
evaluates to ____

By ghostrogue Published 6th October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/ghostrogue/ Last updated 6th October, 2015. Learn to solve cryptic crosswords!
Page 2 of 5. http://crosswordcheats.com
Programming Fundamentals I Cheat Sheet
by ghostrogue via cheatography.com/23817/cs/5332/

CH 2. (cont) CH 3 (cont) CH 3 (cont)

Suppose that alpha and beta are int alpha = The extraction operator >> skips only all F Suppose that x is an int variable and y x=
variables and alpha = 5 and beta = 50 leading blanks when searching for the next is a double variable and the input is: 10, y
10. After the statement alpha *= beta; data in the input stream. 10 20.7 Choose the values after the =
executes, ____. following statement executes: cin >> x 20.7
When reading data into a char variable, T
>> y;.
Suppose that sum and num are int sum = after skipping any leading whitespace
variables and sum = 5 and num = 15 charac​ters, the extraction operator >> finds Suppose that x and y are int variables. cin
10. After the statement sum += num and stores only the next character; reading Which of the following is a valid input >> x
executes, ____. stops after a single character. statement? >> y;

Insertion Point 1 alpha = Entering a char value into an int variable T Suppose that x is an int variable, y is a x=
beta; causes serious errors, called input failure. double variable and ch is a char 15,
beta = If input failure occurs in a C++ program, the F variable and the input is: 15A 73.2 ch =
beta + program terminates immedi​ately and Choose the values after the following 'A', y
1; displays an error message. statement executes: cin >> x >> ch >> =
y; 73.2
In an output statement, each occurrence of F
CH 3 Suppose that x is an int variable, ch is B ch
endl advances the cursor to the end of the
current line on an output device. a char variable, and the input is: 276. = '2',
It is a good idea to redefine cin and cout in F
x=
your programs You can use the function getline to read a T
76
In the statement cin >> x; , x can be a F string containing blanks
Suppose that alpha is an int variable alpha
variable or an expression
and ch is a char variable and the input = 17,
The following statements will result in input F
is: 17A What are the values after the ch =
failure if the input values are not on a
following statements execute? cin » 'A'
separate line. (Assume that x and y are int
alpha; cin » ch;
variab​les.) cin >> x; cin >> y;

The number of input data extracted by cin T


and >> depends on the number of variables
appearing in the cin statement.

By ghostrogue Published 6th October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/ghostrogue/ Last updated 6th October, 2015. Learn to solve cryptic crosswords!
Page 3 of 5. http://crosswordcheats.com
Programming Fundamentals I Cheat Sheet
by ghostrogue via cheatography.com/23817/cs/5332/

CH 3 (cont) CH 3 (cont) CH 3 (cont)

Suppose that x is an int variable, y x = 15, Y Suppose that ch1 and ch2 are char ch1 = Suppose that alpha, beta, and 300
is a double variable, z is an int = 76 . 3 , variables, alpha is an int variable, and 'A', gamma are int variables and the
variable, and the input is: 15 76.3 z = 14 the input is: A 18 What are the values ch2 = input is: 100 110 120 200 210 220
14 Choose the values after the after the following statement ," 300 310 320 What is the value of
following statement executes: cin executes? cin.ge​t(ch1); cin.ge​t(ch2); alpha gamma after the following
>> x >> y >> z; cin >> alpha; = 18 statements execute? cin >> alpha;
cin.ig​nor​e(100, '\n'); cin >> beta;
Suppose that ch1, ch2, and ch3 'C' Suppose that ch1, ch2, and ch3 are 'B'
cin.ig​nor​e(1​00,​'\n'); cin >> gamma;
are variables of the type char and variables of the type char and the
the input is: A B C Choose the input is: A B C What is the value of Suppose that ch1 and ch2 are char W
value of ch3 after the following ch3 after the following statements variables and the input is: WXYZ
statement executes: cin >> ch1 >> execute? cin.ge​t(ch1); cin.ge​t(ch2); What is the value of ch2 after the
ch2 >> ch3; cin.ge​t(ch3); following statements execute?
cin.ge​t(ch1); cin.pu​tba​ck(​ch1); cin
Suppose that x and y are int x = 28, Y When you want to process only partial ignore
>> ch2;
variables, z is a double variable, = 32, z = data, you can use the stream function
and the input is: 28 32.6 12 0.6 ____ to discard a portion of the inp Suppose that ch1 and ch2 are char X
variables and the input is: WXYZ
Suppose that x and y are int This
What is the value of ch2 after the
variables, ch is a char variable, statement
following statements execute? cin
and the input is: 4 2 A 12 Choose results in
>> ch1; ch2 = cin.pe​ek(); cin >> ch2;
the values of x, y, and ch after the input
following statement executes: cin failure In C++, the dot is an operator called member
>> x >> ch >> y; the ____ operator. access

By ghostrogue Published 6th October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/ghostrogue/ Last updated 6th October, 2015. Learn to solve cryptic crosswords!
Page 4 of 5. http://crosswordcheats.com
Programming Fundamentals I Cheat Sheet
by ghostrogue via cheatography.com/23817/cs/5332/

CH 3 (cont) CH 3 (cont)

Suppose that x = 25.67, y = 25.67 356.88 Consider the following program inFile.op​
356.876, and z = 7623.9674. 7623.97 segment. ifstream inFile; //Line 1 int en(​"​pro​g‐
What is the output of the x, y; //Line 2 ... //Line 3 inFile >> x da​ta.d​at​"
following statem​ents? cout << >> y; //Line 4 Which of the following );
fixed << showpoint; cout << statements at Line 3 can be used to
setpre​cis​ion(2); cout << x << ' ' open the file progda​ta.dat and input
<< y << ' ' << z << endl; data from this file into x and y at
Line 4?
x = 55.68, y = 476.859, and z = 55.680
23.8216. statem​ents? cout << 476.860 Suppose that outFile is an ofstream outFil​e.o​
fixed << showpoint; cout << 23.82 variable and output is to be stored in pen​("ou​t‐
setpre​cis​ion(3); cout << x << ' ' the file output​Dat​a.out. Which of the pu​tDa​ta.
<< y << ' ' << setpre​cis​ion(2) following statements opens the file o​ut​");
<< z << endl; output​Dat​a.out and associates
outFile to the output file?
Suppose that x = 1565.683, y 1565.683
= 85.78, and z = 123.982. 85.7800
What is the output of the 123.98
following statem​ents? cout <<
fixed << showpoint; cout <<
setpre​cis​ion(3) << x << ' '; cout
<< setpre​cis​ion(4) << y << ' '
<< setpre​cis​ion(2) << z <<
endl;

What is the output of the 123456​789​012​


following statem​ents? cout << 345​67890
setfil​l('*'); cout << 18​Ha​ppy*​ S​le
"​123​456​789​012​345​678​90" << epy
endl cout << setw(5) << "​18"
<< setw(7) << "​Hap​py" <<
setw(8) << "​Sle​epy​" << endl

What is the output of the 123456​789​012​


following statem​ents? cout << 345​678​901​234​‐
"​123​456​789​012​345​678​901​234​56 567890
7​890​" << endl cout << ####Mickey
setfil​l('#') << setw(10) << Donald​*​Goo
"​Mic​key​" << setfill(' ') << fy
setw(10) << "​Don​ald​" <<
setfil​l('*') << setw(10) <<
"​Goo​fy" << endl;

____ is a parame​terized setfill


stream manipu​lator.

Manipu​lators without iostream


parameters are part of the
____ header file.

By ghostrogue Published 6th October, 2015. Sponsored by CrosswordCheats.com


cheatography.com/ghostrogue/ Last updated 6th October, 2015. Learn to solve cryptic crosswords!
Page 5 of 5. http://crosswordcheats.com

You might also like