NEW
Font size
WorksheetsFunction Inception
Total questions: 20
Worksheet time: 22mins
Which of these is not a type for a function declaration?
void
string
char
number
A function can have _____ inside the parenthesis
loops
Arguments/Parameters
Braces
Types
True or False. A function has to be stated before main and described with the same exact declaration format like type name(aruments)
True
False
function is executed when it is
defined
prototyped
declared
called
A function __________ contains the statements that make up the function.
prototype
definition
call
expression
Which of the following is a complete and correct function definition?
int funct();
int funct(int x){ x = x +1; return x; }
void funct(int){ cout<< “Hello”;
void funct(x){ cout<< “Hello”; return 0; }
What is the return type of the function with prototype: "int func(char x, float v, double t);"?
char
int
float
double
What is the return type of the function with prototype: "string func(int x, char t);"?
string
int
float
double
What will the above code display?
2
2
4
2
2
4
4
4
True or False: A function may or may not return a value back to the caller.
True
False
Fill in the blank to have this function work properly
int function ( ___ x, ____ w) {
cout<<"Let's sum it up";
return x + w;
}
string
int
void
variable
Fill in the blank to have this function work properly
_____ function (int x, int y ) {
for(int i = 0; i < x; i ++){
if(x == y){
cout<<"Found it";
return 0;
}
}
string
int
void
variable
Fill in the blank to have this function work properly
_____ function ( ) {
string hello = "Welcome to my game";
return hello;
}
char
void
string
variable
Fill in the blank to have this function work properly
_____ function ( ) {
double a;
cin >> a;
return a;
}
string
double
int
variable
Fill in the blank to have this function work properly
_____ function ( ) {
int a = 4;
int b = 5;
cout<<"This multiplied quickly " << a*b;
}
string
int
void
variable
Fill in the blank to have this function work properly
_____ function ( ) {
int a = 4;
int b = 5;
cout<<a*b;
}
string
int
void
variable
A function that is void cannot have a _____ _______
variable calculation
printing statement
Return statement
cout statement
What is the return type of the function with prototype: "double func(string x, int s, double t);"?
char
int
string
double
Which of these lines shows the correct code to invoke the function showDub?
int showDub(int x);
showDub(10);
showDub;
showDub(10, 10);
Fill in the blank to have this function work properly
_____ func (int x, int y ) {
for(int i = x; i < x; i ++){
if(x == y){
cout<<"Found it";
}
}
char
void
string
variable
