Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

[CP 2 - CCS0007] M1

Functions

QuestionAnswer
In C++, from which function the execution of a C++programs starts? main() FUNCTION
It states that the function is a non-returning value function VOID
In order to use the sqrt function, we must include the _________ library cmath
Check the given code: int add(int a,int b) { int add; add = a + b; return add; } What would be the returning value data type? int
"Complete the code: #include <iostream> using namespace std; // Print grade for the score _______ printGrade(double score) { if (score >= 90.0) cout << 'A'; else if (score >= 80.0) cout << 'B'; else cout << 'F'; void
It refers to the information that can be passed to a function parameter
What are the mandatory parts of a function declaration? function name and return type
Overloaded functions are: (3) " Two or more functions with the same name but different number of parameters or type"
A type of variable inside a function local
A placeholder of values passed into a function. parameter
Which of the following permits function overloading in C++? types and number of arguments
Two or more functions having the same name but different argument(s) are known as: overloaded function
"The function that returns no value is known as " void function
How many minimum numbers of functions need to be present in a C++ program? 1 int main() program
Which of the following is NOT included in a function declaration? colon :
"How many parameters are there in the function: int theArea(int a,int b, int c)?" 3
Which of the following functions does NOT use the cmath library? rand() it is in <cstdlib>
Which of the following computes for the power of a given number? pow
"What is the return type of the function with the prototype : int functionx (char x, char y) ;" int
The int max (int num1, int num2); code is a function _________________ : declaration
In C++, which of the following is important in a function? function name and return type
"What word is missing below (fill in the blanks). Write a function declaration called increaseTemperature which takes 2 integers as formal parameters. The two parameters represent the upper and lower the function returns the difference between the upper int
Where should default parameters appear in a function prototype? rightmost side of parameter list
When a parameter is passed to a function, it is called ______________. argument
What is the output of the given program? #include < iostream > using namespace std; void mani() void mani() { cout << ""hello""; } int main() { mani(); return 0; } ERORR
What is the output of the program? #include <iostream> using namespace std; int fun(int=0, int = 0); int main() { cout << fun(5); return 0; } int fun(int x, int y) { return (x+y); } 5
It refers to the information that can be passed to a function PARAMETER
When will we use the function overloading? SAME FUCNTION NAME BUT DIFFERENT NUMBERS OF OXYGEN
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 0, int z) { return (x + y + z); } int main() { cout << fun(10); return 0; } ERROR
What is the value that is returned in the following function? int getVolume() { int v; v = 23; if (v < 50) { return 50; } return v; } 50
Which of the following has 2 parameters? "void myGrade1(int x, int y) "
To execute the codes of function, the user-defined function needs to be __________. INVOKED
In order to define the absolute value of a number we should use: ABS
If the user didn’t supply the user value means, then what value will the function take? default value
What symbol is used to set a default parameter value? =
Which of the following function declaration using the default argument is correct? "int foo(int x=5, int y, int z=10) int foo(int x=5, int y =10, int z) int foo(int x, int y =5, int z=10)"
What will happen when we use a void in argument passing? it will not return a value to its carrier
Which of the following function gets the floor of a number? floow
What is the default argument of b in the function? int sum(int a=10, int b, int c=30); error
To call the function startCall() with the number 4432 and 3, what would you write in the main() function? startCall(4432, 3);
What is the output for the given program? #include <iostream> using namespace std; void f1() { cout <<1;} int main() { f1(); goto x; cout << ""hello""; x: cout << ""hi""; return 0;} 1hi
What will you use if you do NOT intended to return value? void
Which of the following is a valid function call (assuming the function exists)? functCall();
In a program you saw the following: int myFunctionTools(int x) float myFunctionTools(float x) double myFunctionTools(double x, double y) What‘s the best description of the given functions?" functions are overloaded
A type of variable inside a function local
A placeholder of values passed into a function. jparameter
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 0, int z=2) { return (x + y + z); } int main() { cout << fun(10); return 0; } 12
If the user didn’t supply a value in a function, then what value will it take? default value
qA function can be called from another function using its ____________ name
What are the advantages of passing arguments by reference? changes to the parameter values within the function also affects the original arguments
In the following declaration, what is the return type? int myMethod(int count, double value) { return 4; } int
What is the output of the following code? #include<iostream> using namespace std; int fun(int x = 0, int y = 8, int z=2) { return (x + y + z); } int main() { cout << fun(10); return 0; } 20
In C++, the block of code begins and ends with: {}
It refers to subprograms or procedure function
What is the output of the following code? #include <iostream> using namespace std; void f1() { cout <<1<< endl;} int main() { f1(); return 0;} 1
Which of the following is a complete function? int functCall (int x) {return x = x+1;}
The main function in C++ is __________________. int main()
In the function void primeNumber (int n); which of the following is NOT true? Arguments are passed but it has no returning value
In C++, the function prototype is also known as _________________________ function declaration
What is the return value of the following function: double myRewards(double x, double y)? double
In order to use the round function, we must include the _________ library cmath
When do we define the default values for a function? the the function is declared
Where does the “return statement” return the execution of the program? caller function
Which value will it take when both user and default values are given? user value
Which of the following is NOT a proper function prototype (definition)? func(int x)
Which of the following function gets the ceiling of a number? ceil
In C++, arguments to functions always appear within ______________. parenthesis
Where does the execution of the program starts? main function
Which of the following is NOT a built-in function? getScore();
If we start our function call with default arguments, then what will be the proceeding arguments? default arguments
Which of the following does return a precision number? double myGrade (double p, double q) precision numbers == numbers with decimals
In order to return a value from a function you must use: return
Which of the following does return a character? char myGrade(int x)
"What is the output of the program? #include < iostream > using namespace std; void fun(int x, int y) { x = 20; y = 10; } int main() { int x = 10; fun(x, x); cout << x; return 0; }" 10
A function can return a value by calling using the keyword _____________ return
Which of the following computes for the square root of a number? sqrt
What symbol is used to end a function declaration? semicolon
How many parameters are there in the function: int add(int a,int b)? 2
In C++, ________________ are the building blocks of C++ programs functions
What is the output of the following code? #include <iostream> using namespace std; void f1() { cout <<1<< endl;} int main() { f1(); return 0;} 1
Which of the following is NOT a built-in function? TheSum
In C++, variables can be passed to a function by: pass by value pass by reference pass by pointer
Where does the default parameter can be placed by the user? rightmost
Which if the following is a way to pass an argument in C++? call by value call by reference
What is the output of the program? #include < iostream > using namespace std; void fun(int x, int y) { x = 20; y = 10; } int main() { int x = 10; fun(x, x); cout << x; return 0; } 10
What is the return type of the function with the prototype : int functionx (char x, char y) ; int
A function with no return value is _______________. void
What is the default argument of b in the function? int sum(int a=10, int b, int c=30); no display output
Which of the following returns an integer? int myRoundedGradient(int x)
Which of the following computes for the absolute value for int? abs
The return type of the function float divide (float a, float b)) is : float
What is the output of the following code? #include <iostream> using namespace std; void f1() { cout <<1<< endl;} int main() { f1(); return 0;} 1
When two functions with the same name are defined in the same scope, the function is: overloaded
Which of the following is a complete function? int functCall (int x) {return x = x+1;}
Library functions are also known as _______ function: built-in
Which of the following is NOT a proper function prototype (definition)? func(int x)
Which of the following function is used to accept user inputs? cin
Which of the following doesn’t return a value? void myPassingGrade
Which of the following is NOT a proper function prototype (definition)? double fun(char x)
In the function void primeNumber (int n); which of the following is NOT true? function is overloaded
Created by: kwatrokwatro
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards