Exam 6: User-Defined Functions
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Input/Output50 Questions
Exam 4: Control Structures I (Selection)50 Questions
Exam 5: Control Structures II (Repetition)50 Questions
Exam 6: User-Defined Functions50 Questions
Exam 7: User-Defined Simple Data Types, Namespaces, and the string Type50 Questions
Exam 8: Arrays and Strings50 Questions
Exam 9: Records (structs)50 Questions
Exam 10: Classes and Data Abstraction50 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Linked Lists50 Questions
Exam 17: Stacks and Queues50 Questions
Exam 18: Searching and Sorting Algorithms50 Questions
Exam 19: Binary Trees50 Questions
Exam 20: Graphs50 Questions
Exam 21: Standard Template Library (STL)50 Questions
Select questions type
Assume that all variables are properly declared.The following statement in a value-returning function is legal.
if (x % 2 == 0)
return x;
else
return x + 1;
(True/False)
5.0/5
(44)
____________________ identifiers are not accessible outside of the function (block).
(Short Answer)
4.9/5
(34)
The following return statement returns the value 10.
return 10,16;
(True/False)
4.8/5
(28)
The data type of a variable in a return statement must match the function type.
(True/False)
4.8/5
(34)
The execution of a return statement in a user-defined function terminates the program.
(True/False)
4.8/5
(41)
Given the following function prototype: int test(float,char);,which of the following statements is valid?
(Multiple Choice)
5.0/5
(33)
Once you write and properly debug a function,you can use it in the program (or different programs)again and again without having to rewrite the same code repeatedly.
(True/False)
4.9/5
(41)
A variable listed in a header is known as a(n)____ parameter.
(Multiple Choice)
4.9/5
(25)
Assume the following. static_cast<int>('a')= 97
Static_cast<int>('A')= 65
The output of the statement:
Cout << static_cast<int>(tolower('B'))<< endl; is ____.
(Multiple Choice)
4.8/5
(30)
When you attach & after the dataType in the formal parameter list of a function,the variable following that dataType becomes a(n)____________________ parameter.
(Short Answer)
4.8/5
(41)
Given the function prototype: double testAlpha(int u,char v,double t); which of the following statements is legal?
(Multiple Choice)
4.8/5
(41)
Given the function prototype: float test(int,int,int);
Which of the following statements is legal?
(Multiple Choice)
4.9/5
(27)
A variable for which memory is allocated at block entry and deallocated at block exit is called a(n)____________________ variable.
(Short Answer)
4.8/5
(37)
____________________ parameters are useful in three situations:
• When the value of the actual parameter needs to be changed
• When you want to return more than one value from a function
• When passing the address would save memory space and time relative to copying a large amount of data
(Short Answer)
4.8/5
(38)
What value is returned by the following return statement? int x = 5;
Return x + 1;
(Multiple Choice)
5.0/5
(44)
The following function heading in a C++ program is valid:
int funcExp(int u,char v,float g)
(True/False)
4.8/5
(39)
In C++,a function prototype is the function heading without the body of the function.
(True/False)
4.8/5
(33)
If a function needs to return more than one value,as a rule of good programming style,you should change it to a(n)____________________ function and use the appropriate reference parameters to return the values.
(Short Answer)
4.8/5
(36)
Showing 21 - 40 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)