Studying for COSC midterm

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

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

false

The device that stores information permanently (unless the device becomes unusable or you change the information by rewriting it) 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

The command that does the linking on Visual C++ Express (2013 or 2016) and Visual Studio 2015 is Make or Remake

false, The Build or Rebuild is the command, which does the linking on Visual C++ Express

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

false, an arithmetic expression consisting of operands of different data types are usually called a mixed arithmetic expression.

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

false, an operator that consists of only one operator is known as unary operators.

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

____________________ rules determine the meaning of instructions.

semantic

A data type is called ____________________ if the variable or named constant of that type can store only one value at a time.

simple

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

true

main memory is directly connected to the CPU

true

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

true, function getLine reads all characters in the line including any blanks, if any, until itreaches end of the current line

Suppose a = 5. After the execution of the statement ++a; the value of a is 6.

true, the pre-increment operator increments the value of a by 1

An example of a floating point data type is ____.

double, the data type double is an example of a floating point data type.

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

enumeration

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

object-oriented

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

true

The programming language C++ evolved from ____

The C++ programming language is evolved from the programming language C

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

True

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

True, in the absence of parentheses in a C++ arithmetic expression, using the precedence rules, operators are usually evaluated from left to right.

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

True, the maximum number of digits in the data type float is 6 or 7

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

True, the number of input data extracted by cin and >> is based on the number of variables inthe statement. If more number of inputs are given, then it just skips the additional inputand take only required number of inputs

____ consists of 65,536 characters

Unicode is an international encoding standard. It consists of 65,536characters. Two bytes are required to store a Unicode character.

. The term GB refers to ____

The binary unit gigabyte is also referred to as GB. 1 gigabyte (GB) contains1024 megabytes (MB)

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

The length of the string is the number of character in the string including any spaces in it. Thus the length of the string "computer science" is 16

____ are executable statements that inform the user what to do

Prompt lines are executable lines that tell the programmer what to do

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

Reserved words are typically referred as keywords. They cannot be redefined within in any programs.

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

The maximum number of digits in data type double is 15.

The memory allocated for a float value is ____ bytes.

The memory allocated for a float data type value is 4 bytes

The value of the expression 17 % 7 is ____.

The operator % determines the remainder of the division. Thus, 17 % 7 = 3

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

The post-increment operator increments the value of count by 1. Thus, the value of count after the execution of count++; is 2

Dividing a problem into smaller subproblems is called ____ design

The structured design is the process of dividing a problem into smaller subproblems.

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

When the operator / is used with int data type, it performs ordinary division and performs quotient as result and integer division truncates the fractional part. Thus, 33/10 = 3.

The devices that feed data and programs into computers are called ____ devices

The devices that feed data and programs into computers are called input devices. Examples of an input device are a keyboard, scanner, and mouse

The devices that the computer uses to display results are called ____ devices

The devices that the computer uses to display results are called output devices. Examples of output devices are monitors and printers

The digit 0 or 1 is called a binary digit, or ____

The digit 0 or 1 is called a binary digit, or bit. A sequence of eight binary digits is called a byte

____ is a valid int value

46259 is a valid integer. NO DECIMALS, NO COMMAS, NO NEGATIVE

A program called a(n) ____ translates instructions written in high-level languages into machine code

A compiler is a program which translates instructions written in high-level languages into machine code

A program that loads an executable program into main memory is called a(n) ____

A loader is a program that loads an executable program into main memory

Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s)____ a. beta = beta + 1; alpha = beta; b. alpha = beta; beta = beta + 1; c. alpha = alpha + beta; d. alpha = beta + 1

A, In the statement alpha = ++beta;, first beta is incremented by 1 and then the value of beta is assigned to alpha.

Several categories of computers exist, such as ____

Correct. Several categories of computers exist, such as mainframe, midsize, andmicro

Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s)____. a. alpha = 1 - beta; b. alpha = beta - 1; c. beta = beta - 1; alpha = beta; d. alpha = beta; beta = beta - 1;

D, In the statement alpha = beta--;, first the value of beta is assigned to alpha and then beta is decremented by 1; so alpha = beta; beta = beta - 1; is a valid choice.

Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____ a. sum = 0 b. sum = 5 c. sum =10 d. sum = 15

D. The statement sum += num; results in adding the values of sum and num; thatis, sum + num = 5 + 10 = 15, and then storing the result in sum.

. ____________________ signals represent information with a sequence of 0s and 1

Digital

____ represent information with a sequence of 0s and 1s

Digital signal is a type of electrical signal. The digital signals represent information with a sequence of 0s and 1s. A low voltage will be represented by a 0and a high voltage will be represented by a 1

____ is a valid char value

'A', Correct. A value belonging to char data type is a single character, enclosed within single quotation marks. Thus, 'A' is a valid character value.

The ASCII data set consists of ____________________ character

128

A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time is called a(n) ____

An algorithm is a step-by-step problem-solving process; it helps to find asolution in a finite amount of time

A(n) ____ consists of data and the operations on those data.

An object consists of data and the operations on those data. An object is the combination of data and operations on the data

____ programs perform a specific task.

Application programs perform a specific task. Games and word processors are examples of application programs

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?

At the top of the C++ Program

The declaration int a, b, c; is equivalent to which of the following? a. inta , b, c; b. int a,b,c; c. int abc; d. int a b c;

B, The declaration int a,b,c; is equivalent to int a , b, c;.

A sequence of eight bits is called a ____.

Byte is a unit used to represent digital information. A sequence of eight binary digits (bits) is called a byte

Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s)____ a. alpha = 1 - beta; b. alpha = beta - 1; c. beta = beta - 1; alpha = beta; d. alpha = beta; beta = beta - 1;

C, In the statement alpha = --beta, first beta is decremented by a value 1 and then assigned to alpha.

Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s)____ a. alpha = 1 + beta; b. alpha = alpha + beta; c. alpha = beta; beta = beta + 1; d. beta = beta + 1; alpha = beta

C, In the statement alpha = beta++;, first the value of beta is assigned to alpha and then beta is incremented by 1; so alpha = beta; beta = beta + 1; is a valid choice.

Suppose that x is an int variable and y is a double variable. The input is 10 20.7 Choose the values after the following statement executes: cin >> x >> y; a. x = 10, y = 20 b. x = 10, y = 20.0 c. x = 10, y =20.7 d. x = 10, y = 21.0

C. Since x is an int variable and y is a double variable, after reading 10 into x,the extraction operator reads and stores 20.7 into y. Thus, after the statement cin >> x>> y; executes x = 10 and y = 20.7

Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta;executes, ____. a. alpha = 5 b. alpha = 10 c. alpha = 50 d. alpha = 50.0

C. The statement alpha *= beta results in multiplying the values of alpha and beta; that is, alpha * beta = 5 * 10 = 50, and then storing the result in alpha.

Choose the output of the following C++ statement:cout << "Sunny " << '\n' << "Day " << endl a. Sunny \nDay b. Sunny \nDay endl c. Sunny Day d. Sunny \n Day

C. When a newline escape sequence \n is used in output statement, the insertionpoint or cursor point moves to the beginning of the next line. Thus, Sunny is printed inthe first line and \n moves the cursor to the next line and printing Day

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

False, in the given C++ statement, the extraction operator >> is binary. Left-side to extraction operator is the input stream variable cin and right-side to extraction operator is variable x. The purpose of cin is to read and store values in variables, where variables refer to memory locations

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

False, the extraction operator >> not only skips leading blanks but also skips all leading whitespaces. Whitespaces consist of blanks and certain non-printable characters such as tabs and new line characters

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, the input values can be in the same line separated by whitespaces or in separate lines.

When you compile your program, the compiler identifies the logic errors and suggests how to correct them

False, the syntax errors in a program can be identified by a compiler while compiling theprogram. Also, the compiler suggests how to correct the errors

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

High-level

Which of the following is a reserved word in C++?

In C++, char is a reserved word.

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

In the evaluation of static_cast<dataTypeName>(expression), first the expression is evaluated and its value is converted to the data type specified bydataTypeName. Thus, the evaluation result is 6+7 = 13.

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

In the evaluation of static_cast<dataTypeName>(expression), first the expression is evaluated and its value is converted to the data type specified bydataTypeName. Thus, the evaluation result is 9

The basic commands that a computer performs are ____, and performance of arithmetic and logical operations.

Input, output, storage, and performance of arithmetic and logical operations are the basic commands performed by a computer

A program called a(n) ____ combines the object program with the programs from libraries.

Linker is a program which combines the object program with the programs from libraries

Main memory is called ____

Main memory is also called random access memory (RAM)

Main memory is an ordered sequence of items, called ____.

Main memory is an ordered sequence of items, called memory cells.

The ____ handles the overall activity of the computer and provides services

Operating system is a system program that handles the overall activity of the computer and provides services

Which of the following is the newline character? a. \r b. \n c. \l d. \b

b. The escape sequence \n is newline character

. In C++, the mechanism that allows you to combine data and operations on the data into a single unit is called a(n

class

____________________ 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

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

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

false, if input failure occurs in a C++ program, the program does not terminate immediately displaying an error message, instead program quietly continues to execute with whatever values are stored in the variables and produces incorrect results

A comma is also called a statement terminator.

false, in C++ a SEMICOLON is known as a statement terminator.

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

false, redefining cin and cout in the programs is not a good idea as its already defined and have specific meanings in C++

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

false, the escape sequence \r moves the cursor to the start of the current line

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

false, the manipulator endl is used to move the insertion point to the beginning of the next line.

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 memory space for a(n) ____________________ data value is 4 bytes.

int

Assembly language uses easy-to-remember instructions called ____________________

mnemonics

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. The statement reads the value 10.5 and stores it in one and reads the value30.6 and stores it in two.

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

operating system

The maximum number of significant digits is called the ____________________

precision

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

predefined, system.

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

preprocessor

Which of the following is a legal identifier?

program_1, A legal C++ identifier contains digits, letters, and the underscore character and must start with a letter or underscore character

____________________ is the process of planning and creating a program.

programming

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

string

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

subprogram, function, module

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

syntax, syntax rules decide whether the given statement is legal or accepted by the programming language.

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

token

When reading data into a char variable, after skipping any leading whitespace characters, the extraction operator >> finds and stores only the next character; reading stops after reading a single character.

true, to input data into a char variable, after skipping any leading whitespaces, the extraction operator >> extracts the next character from the input stream and stores it in the char variable appearing in the input statement.

Suppose we declare a variable sum as an int. The statement "sum += 7;" is equivalent to the statement "sum= sum + 7;"

true, using the compound operator +=, one can rewrite the assignment a= a + b as a += b

Entering a char value into an int variable causes serious errors, called input failure.

true, while giving the inputs one should be more cautious because computers does not tolerate with the mismatch of variables

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

variable

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

whitespaces


Set pelajaran terkait

Final Exam (Health and Life insurance)

View Set

Chapter Two- Health Care Syetems. Government Agencies.

View Set

Developmental Psychology Final Exam

View Set

Nursing Process - Acid/Base Balance: Lec 9

View Set

Global Business final ( ch 8, 9, 10)

View Set

SY0-601 SEC+ Social Engineering Techniques & Attack Types

View Set