COMPSCI 72943

subject Type Homework Help
subject Pages 10
subject Words 1617
subject Authors Harvey Deitel, Paul J. Deitel

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
The strtol and stroul functions do not
(a) need a special header file in order to be used.
(b) take three arguments.
(c) have to convert the entire string they are given.
(d) have the ability to output data in base 8.
Which symbolic constant must be defined to ignore all assert statements?
(a) DEBUG
(b) NDEBUG
(c) NOASSERT
(d) UNASSERT
Which of the following statements is true?
(a) Files written in binary format are always portable.
(b) C11's new exclusive mode allows fopen to open a file only if it does not already
exist.
page-pf2
(c) All platforms allow you to open an unlimited number of files.
(d)None of the above
Which statement about the parameter definition
int (*compare)(int, int)
is false?
a) It defines a parameter that is a pointer to a function that receives two integer
arguments and returns a pointer to an integer as a result.
b) Parentheses are needed around *compare because * has a lower precedence than the
parentheses enclosing the function parameters.
c) Without the parentheses it would have defined a function that receives two integers
and returns a pointer to an integer.
d) The corresponding parameter in the function prototype would ordinarily be
int (*)(int, int)
Which statement is true?
a) Random access file-processing programs typically read and write one field at a time.
page-pf3
b) Random access file-processing programs typically read and write one struct at a
time.
c) The sizeof operator is a run-time unary operator that returns the size in bytes of its
operand.
d) The expression sizeof(int) always returns 4.
Function __________ inputs the next character from the standard input and returns it as
an integer.
a) inputchr
b) getchr
c) inputchar
d) getchar
Recursion is to the base case as iteration is to ________?
(a) the counter
(b) an iteration statement
(c) failure of the loop continuation test
page-pf4
(d) a selection statement
Q2: A class-scope variable hidden by a block-scope variable can be accessed by
preceding the variable name with the class name followed by:
a. ::
b. :
c. .
d. ->
What would be the output of the following statement?
char* value = 'hello';
printf( '%s', value );
(a) h
(b) hello
(c) value
(d) none of these
page-pf5
Evaluate (00001000 & 11000101) ^ (11110000)
(a) 00111101
(b) 11000000
(c) 00111101
(d) 11110000
__________ values can consist of the digits 0 through 9 and the letters A through F.
a) hexadecimal
b) binary
c) octal
d) decimal
page-pf6
Which statement is false?
a) Function strcpy copies its first argument into its second argument.
b) Function strncpy does not necessarily copy the terminating null character of its
second argument.
c) A common error is not appending a terminating null character to the first argument of
a strncpy when the third argument is less than or equal to the length of the string in the
second argument.
d) The first character of the second argument of strcat replaces the null character that
terminates the string in the first argument.
Preprocessing occurs
(a) before a program is compiled.
(b) during compilation.
(c) after compilation but before execution.
(d) immediately before execution.
Assuming that string1 = "hello" and string2 = "hello world", Which of the following
page-pf7
returns 0?
(a) strcmp(string1, string2);
(b) strcmp(string1, string2, 6);
(c) strncmp(string1, string2, 6);
(d) strncmp(string1, string2, 5);
Q2: Which of the following C++ Standard Library header files does not contain a C++
Standard Library container class?
a. <vector>.
b. <list>.
c. <stack>.
d. <string>.
Which statement is false.
a) Variables may be defined anywhere in the body of main.
b) All variables must be defined before they are used.
page-pf8
c) All variable definitions must include the name and data type of each variable.
d) Several variables of the same data type may be defined in one definition.
The __________ is called a single-selection statement.
a) if
b) when
c) ifelse
d) switch
Which statement is true?
a) When an argument is passed call by reference, a copy of the argument's value is
made and passed to the called function.
b) With call by reference, changes to the passed value do not affect the original
variable's value in the calling functions.
c) Call by value should be used whenever the called function does not need to modify
the value of the caller's original value.
d) Call by value should only be used with trusted called functions that need to modify
the original variable.
page-pf9
Which statement is true?
a) The break statement causes an immediate exit from a while, for, do while or if else
statement.
b) The continue statement is designed for use with the while, for, do while or switch
statements.
c) An equivalent while statement for any for statement can always be formed.
d) The break statement causes an immediate exit from a while, for, do while or switch
statement.
Which of the following is true?
a) A union typically makes less efficient use of memory than a struct.
b) A union is another name for a struct.
c) A union is a derived data type whose members share the same storage space.
d) Unions are always portable between different computers with different compilers.
page-pfa
Q1: A default constructor has how many parameters?
a. 0.
b. 1.
c. 2.
d. Variable number.
Assemblers__________.
(a) convert machine language into high-level language.
(b) convert assembly language into machine language.
(c) convert high-level language into machine language.
(d) convert high-level language into assembler language.
page-pfb
For a non-empty linked list, select the code that should appear in a function that adds a
node to the end of the list. newPtris a pointer to the new node to be added, and lastPtris
a pointer to the current last node. Each node contains a pointer nextPtr, a link to a node.
(a)
lastPtr->nextPtr = newPtr;
lastPtr = newPtr;
(b)
lastPtr = newPtr;
lastPtr->nextPtr = newPtr;
(c)
newPtr->nextPtr = lastPtr;
lastPtr = newPtr;
(d)
lastPtr = newPtr;
newPtr->nextPtr = lastPtr;
Which statement is used to skip the remainder of the body of an iteration statement and
proceed with the next iteration of the loop?
a) skip
b) proceed
c) continue
d) jump
page-pfc
Function fscanf takes an argument of type ________.
(a) FILE pointer
(b) cfPtr
(c) char
(d) int
Which mode would you use if you wanted to open a file for both reading and writing?
(a) r+
(b) w+
(c) a+
(d) all of these
page-pfd
Q4: Parameterized stream manipulator setfill specifies the fill character that's displayed
when an output is displayed in a field wider than the number of characters or digits in
the output. The effect of setfill applies:
a. Only to the current value being displayed.
b. Only to outputs displayed in the current statement.
c. Until explicitly set to a different setting.
d. Until the output buffer is flushed.
Q2: Default type parameters are allowed only:
a. If the class template also has nontype parameters.
b. If the class template does not have any nontype parameters.
c. If the class is used as a container class.
d. As the rightmost (trailing) parameters in a template's type-parameter list.
extern
page-pfe
(a) is a keyword to indicate that a variable is defined in a different file
(b) is used to access command-line arguments
(c) can be used as a control structure
(d) is a data type
Which statement is false?
a) Executable C statements either perform actions or make decisions.
b) If the condition in an if statement is met, the statement in the body of the if statement
is executed.
c) All the relational operators have the same level of precedence.
d) The equality operators have a higher level of precedence than the relational
operators.
Q1: C++ functions other than main are executed:
a. Before main executes.
b. After main completes execution.
page-pff
c. When they are explicitly called by another function.
d. Never.
Which of the following is an argument of the fseek function that can have the values
SEEK_SET,
SEEK_CUR or SEEK_END?
(a) stream
(b) offset
(c) whence
(d) none of these
Which of the following operating systems require special settings for processing
command-line arguments?
(a) Macintosh
(b) DOS
(c) UNIX
(d) all of the above
page-pf10
________ may contain different data types.
(a) structures
(b) arrays
(c) both a and b
(d) none of these

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.