CS1 Midterm

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Putting ____________________ in front of a logical expression reverses the value of that logical expression.

!

A program called a ___________ translates instructions written in high-level code languages into machine code.

Compiler

In C++, you can use a(n) ____________________ to instruct a program to mark those memory locations in which data is fixed throughout program execution.

Constant Global

Main memory is called Ram

True

Main memory is directly connected to the CPU.

True

Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

True

The extraction operator >> skips only all leading blanks when searching for the next data in the input stream.

True

The maximum number of significant digits in float values is up to 6 or 7

True

The maximum number of significant digits in values of the double type is 15.

True

The number of input data extracted by cin and >> depends on the number of variables appearing in the cin statement.

True

To develop a program to solve a problem, you start by analyzing the problem

True

You can use the function getline to read a string containing blanks

True

suppose a = 5. After ++a executes, the value of a is 6

True

________ consists of 65,536 characters.

Unicode

A(n) ____________________ is a memory location whose contents can be changed.

Variable

The following statements will result in input failure if the input values are not on a separate line. (Assume that x and y are int variables.) cin >> x; cin >> y;

false

Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____.

Sum = 15

Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl;

Sunny Day

When you compile, the compiler identifies the logic errors and suggests how to connect them.

False

Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following expression: z = (y / x > 0) ? x : y;.

2

The basic commands that a computer performs are input (get data), output (display result), storage, and performance of arithmetic and logical operations.

True

The value of the expression 7 + 8 <= 15 is ____________________.

True

Suppose that x = 25.67, y = 356.876, and z = 7623.9674. What is the output of the following statements? cout << fixed << showpoint; cout << setprecision(2); cout << x << ' ' << y << ' ' << z << endl;

25.67, 356.88, 7623.97

17%7 =

3

char lastInitial = 'S'; switch (lastInitial) { case 'A': cout << "section 1" <<endl; break; case 'B': cout << "section 2" <<endl; break; case 'C': cout << "section 3" <<endl; break; case 'D': cout << "section 4" <<endl; break; default: cout << "section 5" <<endl; }

Section 5

In a C++ program, ____________________ are used to separate special symbols, reserved words, and identifiers

Tokens

A compound statement functions as if it was a single statement

True

In C++, && has a higher precedence than ||.

True

In the statement cin >> x;, x can be a variable or an expression

True

Information stored in main memory must be transferred to some other device for permanent storage.

True

The _______ is the brain of the computer and the most expensive piece.

CPU

A(n) ____________________ is a sequence of zero or more

Characters Array

____________________ can be used to identify the authors of the program, give the date when the program is written or modified, give a brief explanation of the program, and explain the meaning of key statements in a program.

Comments

It is a good idea to redefine cin and cout in your programs.

False

Suppose found = true and num = 6. The value of the expression (!found) || (num > 6) is ____________________

False

The escape sequence \r moves the insertion point to the beginning of the next line

False

The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.

False

The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.

False

The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

False

A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a ____________.

Algorithim

A(n) ____________________ is a collection of statements, and when it is activated, or executed, it accomplishes something.

Function

The term GB refers to __________.

Gigabytes

____________________ languages include FORTRAN, COBOL, Pascal, C, C++, and Java

High-level

When you want to process only partial data, you can use the stream function ____ to discard a portion of the input.

Ignorw

When a value of one data type is automatically changed to another data type, a(n) ____________________ type coercion is said to have occurred.

Implicit

The smallest individual unit of a program written in any language is called a(n) ____________________.

Statement

The devices that feed data and programs into computers are called ______ devices.

Input

What does <= mean?

Less than or equal/operational operator

C++ comes with a wealth of functions, called ____________________ functions, that are written by other programmers.

Library

Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7

True

The digit or 1 is called a binary digit, or ______

bit

A sequence of eight bits is called a _______

byte.

C++ provides a header file called ____________________, which is used for file I/O

fstream

Manipulators without parameters are part of the ____ header file.

iostream

A program called a ______ combines the object program with the programs from libraries.

linkers

When one control statement is located within another, it is said to be ____.

nested

In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____.

one =10.5, two = 30.6

A control structure alters the normal sequential flow of execution in a program.

true

The ASCII data set consists of ____________________ characters.

128

The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____.

13

The length of the string "computer science" is ____.

16

Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____.

2

int x = 55; int y = 5; switch (x % 7) { case 0: case 1: y++; case 2: case 3: y = y + 2; case 4: break; case 5: case 6: y = y - 3; }

2

The value of the expression 33/10, assuming both values are integral data types, is ____.

3

int x; x = (5 <= 3 && 'A' < 'F') ? 3 : 4;

4

Suppose that x = 55.68, y = 476.859, and z = 23.8216. What is the output of the following statements? cout << fixed << showpoint; cout << setprecision(3); cout << x << ' ' << y << ' ' << setprecision(2) << z << endl;

55.860, 476.859, 23.82

The expression static_cast<int>(9.9) evaluates to ____.

9

Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____.

Alpha = 50 beta = 5

_______ programs perform a specific task

Application

The ____________________ of relational and logical operators is said to be from left to right.

Associativity

_______ represent information with a sequence of 0s and 1s.

Binary number

The ____________________ type is C++'s method for allowing programmers to create their own simple data types.

Enum

A mixed arithmetic expression contains all operands of the same type.

False

An operator that has only one operand is called a unique operator.

False

C++ programs have always been portable from one compiler to another

False

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.

False

If input failure occurs in a C++ program, the program terminates immediately and displays an error message

False

If the expression in an assert statement evaluates to true, the program terminates

False

In C++, !, &&, and || are called relational operators

False

In C++, both ! and != are relational operators.

False

In C++, reserved words are the same as predefined identifiers

False

In an output statement, each occurrence of endl advances the cursor to the end of the current line on an output device.

False

The device that stores information permanently is called primary storage.

False

The devices that feed data and programs into computers are called output devices.

False

When the computer is turned off, everything in secondary memory is lost.

False

Consider the following code. // Insertion Point 1 using namespace std; const float PI = 3.14; int main() { //Insertion Point 2 float r = 2.0; float area; area = PI * r * r; cout << "Area = " << area <<endl; return 0; } // Insertion Point 3 In this code, where does the include statement belong?

Insertion point 1

____________________ functions are those that have already been written and are provided as part of the system.

Library

____ are executable statements that inform the user what to do.

Menu

In ____________________ design, the final program is a collection of interacting objects

Object Oriented design

In object-oriented design, the first step in the problem-solving process is to identify the components called ____________________, which form the basis of the solution, and to determine how they interact with one another.

Objects

The ____________________ monitors the overall activity of the computer and provides services such as memory management, input/output activities, and storage management.

Operating Systems

The devices that the computer uses to display are called __________ devices.

Output

The function ____________________ returns the next character in the input stream; it does not remove the character from the input stream

Peek

In a C++ program, statements that begin with the symbol # are called ____________________ directives.

Pre-processor

The maximum number of significant digits is called the ____________________.

Precision

A _________ consists of data and the operations on those data.

Program

Putting a semicolon after the parentheses following the expression in an if statement (that is, before the statement) is a(n) ____________________ error

Syntax

The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language

Syntax

____________________ rules determine the meaning of instructions

Syntax

The basic commands that a computer preforms are ________, and performance of arithmetic and logical operations

input/output


Set pelajaran terkait

Data Structure Interview Questions

View Set

Hoofdstuk 1: Waarden, normen, ethiek en moraal

View Set

CHAPTER 30 DISORDERS OF BLOOD FLOW IN THE SYSTEMIC CIRCULATION - Questions

View Set

PSYS 001 - EXAM 1 - 2.2.3 + 4 - Early Schools of Psychology

View Set