WorksheetsC++ Functions
Total questions: 11
Worksheet time: 11mins
A function can have _____ inside the parenthesis
loops
Arguments/Parameters
Braces
Types
A function that has no return type starts with:
int
void
Arguments
Braces
A function that returns a whole number starts with the word
int
void
string
{ }
Fill in the blank to have this function work properly
_____ function ( ) {
int a = 4;
int b = 5;
cout<<a*b;
}
string
int
void
variable
Fill in the blank to have this function work properly
_____ function ( ) {
string greeting = "Welcome to my game";
return greeting;
}
string
void
int
variable
Fill in the blank to have this function work properly
_____ function ( ) {
int a;
cin >> a;
cout<<"You chose " << a <<endl;
}
string
void
int
variable
True or False. We can call functions inside of other functions.
True
False
True or False. A function that returns a string starts with the word void.
True
False
Select all of the types you may have for a function
string
bool
void
variable
int
A function that is not void needs to have a _____ _______
variable calculation
printing statement
Return statement
cout statement
Fill in the blank to have this function work properly
double function ( ) {
int a;
cin >> a;
cout<<"You chose " << a <<endl;
return ____ ;
}
"a"
a
a * 3.14
cin
