CPE Final Help

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The next character to be read from the standard input stream (cin) is A. The statementcin>>num; is the next input statement to execute. If num is an integer variable, the value contained innum after the read is the ASCII value for an uppercase a which is 65

false

In C++ mathematical expressions addition and subtraction are performed before multiplication and division?

false

In C++ the compiler checks to make sure that all index values are valid (correspond to memory allocated for the array)

false

In a loop, event counters are incremented every time the loop body is executed.

false

In a switch statement, if the switch expression matches a case label, control branches to the statements associated with the default label?

false

In an array each component item of the array is accessed by its position in the array

false

The #include statements in a C++ program are interpreted by the compiler?

false

The body of a do-while loop will execute 0 or more times?

false

The default label is required in a switch statement?

false

The following C++ statement is an example of type casting the integer variable num to a floating point value: int num; float var; var = (num)float;

false

The following function call will pass the one dimensional array value into the void function Read? Read(value[ ]);

false

The following is a valid function prototype with a 2 dimensional array as a parameter? void InitArray(floatArray[ ][ ]);

false

The getline function reads the next character only from the input stream regardless of what it is?

false

The getline function skips all whitespace characters when reading from the input stream?

false

The ignore statement cin.ignore('\n'); will ignore characters on the input stream cin until a newline character is encountered?

false

The initialization of the static variable in the declaration shown below occurs every time the statement is encounterd? static int count = 0;

false

The relational operator for testing for equality is a single equals sign (=)?

false

Value parameters are declared using an & after the data type?

false

Value returning functions can use the statement return;

false

When the structure declaration is encountered memory is allocated for the declaration.

false

With a specific structure, the member names do not have to be unique?

false

break statements are optional in a switch statement?

false

in C++ the following statement will decrement the variable num by 1? --num;

false

in C++, void functions return a single function value?

false

in an array, the component items can be of different data types - the array is heterogeneous.

false

the function call for a void function has to be made as part of an expression?

false

Fourth#Edition is a valid identifer in C++ (following strict ANSII C++ standards and material presented in lecture notes)

false(identifiers consist of letters, digits, and underscores only)

What is the definition for a function heading?

first line of the function definition that contains the name of the function, the return type of the function and the function parameter declarations

Which of the following are types of Event Controlled Loops?

flag controlled end of file controlled sentinel controlled

Which of the following can be used as arguments in a function call when the argument is paired up with a value parameter?

named constants variables value returning function calls mathematical expressions literal values

By default arrays are always passed by reference into a function

true

End of File controlled loops can be used to read information from an input file of unknown length

true

Functions cannot directly access identifiers that are declared in other functions?

true

If A = 1, B = -2, C = -3 and D = 4, what is the logical result of the following logical expression? (A || B) && (C&& D)

true

In C++ any non-zero integer value is coerced to a boolean value of true

true

In C++ the following assignment statement is valid? num1 = num2 = num3 = num4 = 0;

true

In a switch statement there can be 0 or more statements associated with a Switch Label?

true

Input and output file streams must be passed into reference parameters in a function?

true

Local variables cannot be accessed outside of the block in which they are declared?

true

Reference parameters receive the memory address of the corresponding argument?

true

The base address of an array is the memory address corresponding to index value 0 for the array?

true

The end of file status bit is changed from false to true when an attempt is made to read beyond the end of an input file?

true

The following is a valid array declaration in C++: float arr[][3] = { {1.0, 2.0, 3.0}, {3, 2, 1}};

true

The insertion operator << is used to insert information into the output file stream in C++?

true

The lifetime of an identifier is the time when memory has been allocated for use by that identifier?

true

The memory allocated to a static variable remains allocated for the duration of the execution of the program?

true

The return value for a value returning function can be ignored by making the function call a standalone statement and not part of an expression?

true

The statement cin.get(ch); obtains the next character, regardless of what it is, from the standard input stream cin? (ch is declared as a character variable)

true

Typically, information is lost when a floating point value is coerced to an integer value.

true

When local variables are declared, they start with their values undefined?

true

When used with a file stream, the clear() function will reset all the status bits for the file stream so that it can be used again.

true

function implementation is hidden and knowledge of the code is not required to use the function

true

Which of the following logical expressions evaluate as true?

true || false true || true false || true

Which of the following are allowed aggregate operations on Arrays?

used as a parameter in a function heading

Which of the following can be used as arguments in a function call when the argument is paired up with a reference parameter?

variables

What is the output for the following code segment? a = 40; if (a>20) cout << "20"; if (a > 30) cout << "30"; if (a > 40) cout << "40";

2030

What is the definition for a function definition?

The code that extends from the function heading to the end of the block that is the body of the function

A global identifier takes precedence over a local identifier with the same name?

false

A simple data type is a DataType in which each value is a collection of component items.

false

Every C++ program must have a function named start

false

For sentinel controlled loops, the best sentinel is a value that IS expected as normal input for the program?

false

If x=10 and y=10, What is the boolean value for the relational expression: x != y

false

A structure declaration must end with a semi-colon?

true

What is the member selector operator that is used to access the members of a structure variable?

. (a period)

Which of the following is a way to put a comment into a C++ program?

//

Given the code segment below: string plant = "Daisy";cout << plant.find('D'); What is the value output by the output statement?

0

What is the output of the following loop? int a = 0; while (a <= 5) { cout << a; a++; } cout << endl << "done\n";

012345 done

A value returning function can return how many function values?

1

Before the code shown below is executed, the input stream (cin) contains the following characters(\n represents the new line character) : 500B\nHello 66\n44\n33 and the reading marker is on the 5 Using the space provided, write what is output to the terminal by the following segment of code. int m = 10; int x = 20; string text = "Null"; char ch = 'A'; getline(cin,text,'\n'); cin.ignore(5,'\n'); cin >> m >> ch; cout << m << "-" << ch << "-" << x << "-" << text << endl;

66-4-20-500B

What is the name of the ECE departments Linux Server?

Blackhawk

What is the output for the following code segment? A = 10; B = 20; if (A == 20) if ( B == 20) cout << "B is 20\n"; else cout << "A is not 20\n"; cout << "Done\n";

Done

Documentation for a program consists of several parts and can be Internal to the program or _____________ to the program?

External

finish the code segment below by selecting the statement that will open the input file specified (typed in) by the user: ifstream InFile; string filename; cout << "enter the name of the input file: "; cin >> filename;

InFile.open(filename.c_str());

Which of the following are ways to structure statements in most programming languages(more than one answer is possible here. you need to select them all)

Loop, Subprogram, Selection, Sequentially

In software Engineering, programmers have a responsibility for developing software that is free from __________________?

Programming Errors

Which of the following are allowed aggregate operations on a structure?

Return value of a value returning function used as a parameter in a function Assignment

From the notes and text, "The set of rules determining the meaning of the instructions written" is the definition for _______________________

Semantics

From the notes and text, "The formal rules for governing how valid instructions are written" is the definition for _______________________

Syntax

What is the output for the following segment of code? x=10; y=20; if (x = y) cout << "X and Y are the same\n"; else cout << "X and Y are not the same\n";

X and Y are the same

According to the notes, which of the following are one of the 4 actions required to use user defined file streams in a C++ program?

declare a file stream variable(input and/or output) Prepare file streams for reading or writing by using the open function to associate a file with the file stream use #include<fstream>

For the code segment below, what is the value output if the user types in 1 A 2 (select the best possible answer) int num1, num2, num3;] cout << "Enter in 3 integers\n"; cin >> num1 >> num2 >> num3; cout << num3;

do not know-filestream went into a fail state

Which of the following are functions that return the boolean status of a file stream status bit?

eof() fail() good()

A continue; statement can be used in which of the following C++ control structures?

for loop do-while loop while loop

An expression is an arrangement of ____________, _________________ and ______________ that can be evaluated to compute a value of a given type

identifiers, operators, literals

Which of the following are part of the integral Types in C++?

int, char, short

Which of the following data types can be used as a switch expression?

integer(int) character(char) boolean(bool)

Which of the following are output file stream manipulators?

left, showpoint, setprecision

Given the C++ code segment below, string str1, str2;str1 = "The_third_Quiz_in_CPE211";str2 = str1.substr(4,8);cout << str2; What is the string value output by the output statement?

third_Qu

A break statement causes the immediate exit from the loop or switch statement in which it appears?

true

A flag controlled loop continues to execute until the boolean flag has its starting value changed from true to false or false to true.

true

A hierarchical structure is a structure in which at least one of the members of the structure is itself a structure?

true

Which of the following is/are a valid function heading for the void function InitArray that will initialize a one dimensional array of integers

void InitArray(int arr[ ]) void InitArray(int arr[10])

Which of the following answers are a possible function heading for a void function named Input that requires two parameters an input file stream and an integer value that has to be passed back to the caller of the function

void Input(ifstream& fileIn, int& value)

Which of the following are Logical operators?

||, !, &&


संबंधित स्टडी सेट्स

Computer Architecture study guide 2020

View Set

Macroeconomics Exam II (HW Drills)

View Set

CH. 7 & 8 ACCT 2110 Miller Exam 3

View Set

Componentes orgánicos de la materia viva

View Set

ch.24 Pituitary and Thyroid Disorders

View Set