Exam 1 Ch 1,2,&3 (COSC 1436)

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the value of x after the following code executes? int x; x =3.....

0

In C++11, if you want an integer literal to be treated as a long long int, you can append ________ at the end of the number (T/F).

LL

What is output of the following statement? cout << 4 * (15/ (1+ 3) ) << end1;

12

What is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0);

125.0

What is the value of number after the following statements execute? int number; number = 18 % 4 + 2;

4

What is the value of number after the following statements execute? int number; number = 18/4;

4

The programmer usually enters source code into a computer with

A text editor

An Integrated Development Environment (IDE) typically consists of

All of these: ( a compiler, a text editor,& a debugger).

At the heart of a computer is its central processing unit. The CPU's job is:

All of these: (To carry out the operations commanded by the instructions, to produce some outcome of resultant information, and to fetch instructions).

Which of the following best describes an operator?

An operator allows you to perform operations on one or more pieces of data

C++ 11 introduced an alternative way to define variables, using the template key word and an initialization value (T/F).

False

In C++ a in impossible to display the number 34.789 in a field of 9 sources with 2 decimal places of precision (T/F)

False

In C++ you are required to name your variables so they indicate the purpose they will be used for (T/F).

False

In programming, the terms "line" and "statement" always mean the same thing (T/F).

False

In programming, the terms "line" and "statement" always mean the same thing T/F

False

Machine language is an example of a high-level language T/F.

False

Programs are often referred to as hardware T/F.

False

The fixed manipulator causes a number to be displayed in scientific?

False

The following statement will output $5 to the screen (T/F)

False

The preprocessor executes after the compiler (T/F).

False

When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive,

False

The CPU's control unit retrieves the next instruction in a sequence of program instructions from main memory in the ______ stage.

Fetch

Words that have a special meaning and mat be used only for their intended purpose are known as

Key words

Which of the following is NOT a valid C++ identifier?

Luser

What will the following code display? int number = 23; cout << "The number is " << "number" << end1;

The number is number

When C++ is working with an operator, it strives to convert the operands to the same type?

True

When typing your source code into the computer, you should be careful since most of your C++ instructions, header files, and variable names are case sensitive (T/F).

True

Which of the following statements will allow the user to enter three value to be stored in variables length, width, and height in that order?

cin, get (length, width, height);

Which of the following statements correctly defines a named constant named TAX_RATE that holds the value 0.075?

const double TAX_RATE = 0.075;

The manipulator forces cout to print digits in fixed point notation.

fixed

Every complete C++ program must have a

function named main

____ reads a line of object. input including leading and embedded space, and stores it in a string

getline

Which of the following statements will read an entire line of input into the string, object address?

getline (cin, address);

When a user types values at the keyboard, those values are first stored

in the keyboard buffer

Three primary activities of a program are:

input, output, & processing

This manipulator causes the field to be left-justified with padding spaces printed to the right.

left

A(n) _______ is a set of instructions that the computer follows to solve a problem.

program

Which of the following function will return the value of x, rounded to the nearest whole number?

round (x)

Programs are normally stored in _______ and loaded into main memory as needed.

secondary storage

The two parts of the CPU are

the Control Unit and the Arithmetic and Logic Unit

What will the following code display? int x = 23, y = 34, z = 45; cout << x << y << z << end1;

233445

What is the value stored in the variable myNum after the following assignment statements executes? myNum = 23 % 5

3

What is the value of number after the following statement execute? int number + 10; num... += 5; num... -= 2; num... *= 3;

39

What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;

4.0

How many characters will the following statement read into the variable mystring? cin >> setw(10) >> mystring;

9

The ______ operate always follows the cin object, and the ______ operator follows the cout object.

>>, <<

Which data type typically requires only one byte of storage?

Char

For every opening brace ({) in a C++ program, there must be a

Closing brace

The ______ decodes an instruction and generates an electronic signal.

Control Unit

Which f the following is NOT one of the major components of a computer system?

The Preprocessor

The purpose of a memory is

To identify the location of a byte in memory

A value is stored in a variable with an assignment statement (T/F).

True

Escape sequences are always stored internally as a single character (T/F).

True

In C++, key words are written in all lowercase letters (T/F).

True

Programming style refers to the way a programmer uses elements such as identifies, spaces, and blank lines (T/F).

True

The CPU is the most important component in a computer because without it the computer could not run software T/F.

True

The cin << statement will stop reading input when it encounter a newline charcter

True

The preprocessor reads a program before it is compiled and only executes those lines beginning with # symbol (T/F).

True

A set of well-defined steps for performing a task or solving a problem is known as a(n).

algorithm

The data type of a variable whose value can be either true or false is

bool

Which of the following will allow the user to input the values 15 & 20 have them stored in variables named bases and height respectively?

cin >> base >> height;

The first step in writing a program is to

clearly define what the program is to do.

Which line in the following program will cause a compiler error?

line 7

Mistakes that cause a running program to produce incorrect results are called:

logic errors

When a variable is assigned a number that is too large for its data type, it:

overflows

The float data type is considered ________ precision and the double data type is considered ________ precision.

single, double

Computer programs are also known as

software

When a programmer saves to a file the statements he or she writes to create a program, these statements are

source code

This is a complete instruction that causes the computer to perform some action:

statement

In a C++ program, two slash marks (//) indicate

the beginning of a comment

When the final value of an expression is assigned to a variable, it will be converted to:

the data type of the variables

Which of the following must be included in any program that uses the cin object?

the header file iostream

What will be displayed after the following statements execute? num1 = 5; num2 = 3; cout << "The result is" << (num1 * num2 + 10) << end1;

the result is 25

A variable definition defines the name of a variable that will be used in a program, as well as:

the type of data it will be used to hold

A named storage location in the computer's memory that holds a piece of information is a(n):

variables


Kaugnay na mga set ng pag-aaral

A&P II Exam 4: Ch. 22 The Respiratory System

View Set

Chapter 24: Management of Patients With Chronic Pulmonary Disease

View Set

Mother Baby Final chapter 5-6 questions

View Set