Exam 6: Functions
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
It is possible for a function to have some parameters with default arguments and some without.
Free
(True/False)
4.8/5
(81)
Correct Answer:
True
This is a collection of statements that performs a specific task.
Free
(Multiple Choice)
4.8/5
(81)
Correct Answer:
D
This is a dummy function that is called instead of the actual function it represents.
Free
(Multiple Choice)
4.7/5
(78)
Correct Answer:
B
The value in this type of local variable persists between function calls.
(Multiple Choice)
4.7/5
(86)
A function __________ eliminates the need to place a function definition before all calls to the function.
(Multiple Choice)
4.7/5
(79)
Given the following function definition
void calc (int a, int& b)
{
int c;
c = a + 2;
a = a * 3;
b = c + a;
}
What is the output of the following code fragment that invokes calc?
(All variables are of type int)
x = 1;
y = 2;
z = 3;
Calc(x, y);
Cout << x << " " << y << " " << z << endl;
(Multiple Choice)
4.7/5
(73)
Look at the following function prototype. int myFunction(double);
What is the data type of the funtion's parameter variable?
(Multiple Choice)
4.8/5
(80)
A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.
(True/False)
4.9/5
(78)
What is the output of the following program?
#include <iostream>
using namespace std;
int getValue(int);
int main()
{
int x = 2;
cout << getValue(x) << endl;
return 0;
}
int getValue(int num)
{
return num + 5;
}
(Multiple Choice)
4.9/5
(71)
A function's return data type must be the same as the function's parameter(s).
(True/False)
4.8/5
(94)
A(n) _________ argument is passed to a parameter when the actual argument is left out of the function call.
(Multiple Choice)
4.9/5
(84)
Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.
(Multiple Choice)
4.7/5
(72)
Here is the header for a function named computeValue: void computeValue(int value)
Which of the following is a valid call to the function?
(Multiple Choice)
4.9/5
(83)
_________ functions may have the same name, as long as their parameter lists are different.
(Multiple Choice)
4.8/5
(73)
You may use the exit() function to terminate a program, regardless of which control mechanism is executing.
(True/False)
4.7/5
(80)
A function can have zero to many parameters, and it can return this many values.
(Multiple Choice)
4.9/5
(71)
What is the output of the following program?
#include <iostream>
using namespace std;
void doSomething(int);
int main()
{
int x = 2;
cout << x << endl;
doSomething(x);
cout << x << endl;
return 0;
}
void doSomething(int num)
{
num = 0;
cout << num << endl;
}
(Multiple Choice)
4.8/5
(69)
Showing 1 - 20 of 49
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)