Computer Science 1428 - Final Exam Review - TXST

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/48

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

49 Terms

1
New cards

What is the appropriate data type to store an email address? ( example blackbirdSR71@spyplane.net)

String data type

2
New cards

What represents storage locations in the computer's memory?

Variables

3
New cards

What will the code below display to the console?
cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";

MondayTuesdayWednesday

4
New cards

(T/F) number and NUMBER are considered to be the same variable name.

False

5
New cards

Which of operator is used to get the remainder from dividing two integers?

Modulus %

6
New cards

(T/F) When C++ is performing assignment, it converts the value on the right-hand side to the type of variable on the left-hand side, even if this causes loss of information.

True

7
New cards

What is the value of the following expression in C++? 18 - 11/2

13. Division first then subtraction
11/2 = 5 (5.5 is truncated to 5, integer division)
18 - 5 = 13

8
New cards

What is the correct way to change the value stored in a variable by adding 1 to is?

variable = variable + 1;

9
New cards

A file must be ______ before data can be written to or read from it.

Opened

10
New cards

(T/F) To read from a file, you must first define a variable of type iostream.

False

11
New cards

What is the correct way to output a number that will have exactly 2 digits after the decimal point?

cout << fixed << setprecision(2);

12
New cards

Is the expression evaluated as true or false?
int a = 2, c = 6;
a + 4 >= 2 *c

False

13
New cards

Is the expression evaluated as true or false?
int a = 2, c = 6;
c > 6

False

14
New cards

Which loop's body will always be executed at least once?

do-while

15
New cards

What is the output of the following c ++ statements?
int x = 1;
while ( x <= 3 )
cout << x;

1111111111111111111111111.......(infinite loop)

16
New cards

(T/F) A variable may be defined (declared) in the initialization expression of the for loop.

True

17
New cards

What kind of expression cannot be used to declare the size of an array in an array declaration?

Variable

18
New cards

What is the subscript of the last element in the following array? int x [100];

99

19
New cards

(T/F) You can used the assignment operator to copy one entire array to another in a single assignment statement. example array1 = array2;

False

20
New cards

Variables that receive values sent into a function are called _______. Example x in: void plusses( int x ) {....}

Parameters

21
New cards

Statements in a function body are executed when the function is :

Called

22
New cards

A function contains this statement: return; What is the return type of the function?

Void

23
New cards

A _______ variable is declared outside all functions.

Global

24
New cards

(T/F) When you use call-by-reference, the parameter is just an alias for the argument variable.(there is only one memory location with two names)

True

25
New cards

Which of the following operators is used to access a member (or field) of a structure?

. (dot)

26
New cards

(T/F) A function may return a structure.

True

27
New cards

(T/F) The contents of and entire structure variable can be displayed by passing the structure variable to the cout object using <<

False

28
New cards

A _______ is used to translate each source code instruction into the appropriate machine language instruction.

Compiler

29
New cards

Which of the following is lost (erased) when its power supply is lost?

Main memory (RAM)

30
New cards

A step by step ordered procedure that solves a problem in a finite number of precise steps is:

An algorithm

31
New cards

What is the exact output of the following C++ code when executed?
cout << "[" << left << setw(8) << 1234 << "]" << endl;

[1234 ]

32
New cards

Which relational expression in C++ will be true when x is between 1 and 100 (inclusive) and false otherwise?

1 <= x && 100 >= x

33
New cards

(T/F) int is a valid variable name in C++.

False

34
New cards

(T/F) MYVARIABLE#3 is a valid variable name in C++.

False

35
New cards

(T/F) a_1_2_3 is a valid variable name in C++.

True

36
New cards

Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;

What is the value of the expression?
d2 / j1

11.1

37
New cards

Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;

What is the value of the expression?
20 - j2 * 2 + j1

17

38
New cards

Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;

What is the value of the expression?
33 % j2

3

39
New cards

Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;

What is the value of the expression?
d2 - j1 - 2

68.7

40
New cards

Given the following variables that have been defined and initialized:
int j1 = 7;
int j2 = 5;
double d1 = 11.67;
double d2 = 77.7;

What is the value of the expression?
j1 = d1; // What is stored in j1 after this?

11

41
New cards

The following are all examples of what?
72 'A' " Hello World " 2.8712

Literals

42
New cards

Which of the following is equivalent to x++?

x = x + 1;

43
New cards

The file must exist in secondary storage before you do what?

Open it for input

44
New cards

(T/F) The = operator and the == operator perform the operation when used in a Boolean expression.

False

45
New cards

(T/F) In pass by value, the value of the argument in the function call is copied into the function parameter. (there are two separate variables)

True

46
New cards

(T/F) Two separate functions in the same program may have local variables with the same name.

True

47
New cards

A program will "fall through" a case section of a switch statement unless it has what?

break

48
New cards

When a loop processes data until it reaches a special value that marks the end of a list of values, it is called a :

Sentinel-controlled loop

49
New cards

What is the output of the code below?
float x = 3.0;
if ( x > 0 )
{
float x = 2.2;
}
cout << x << endl;

3.0