Save
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

CP2-Module 1

User Defined Functions and Parameters

QuestionAnswer
There are two types of functions: Built-in functions & User-defined functions
A __________ is a block of code which only runs when it is called function
In C++, arguments to functions always appear within ______________. parenthesis curly braces double quotes double brackets parentheses
In order to define the absolute value of a number we should use: Absolute abz abs absol abs
The int max (int num1, int num2); code is a function _________________ : Error Call Declaration Parameter Declaration
Procedure, subprograms, and method are synonymous to functions. True or False? True
Which of the following is NOT a proper function prototype (definition)? char letter(); func(int x) void funct(); int secondfunct (char x, char y) ; func(int x)
The return type of the function double averageCall (double, double, double) is : double int char float double
The return type of the function float divide (float a, float b)) is : double int char float float
What will you use if you do NOT intended to return value? static const int void void
What symbol is used to end a function declaration? semicolon colon ampersand pound sign semicolon
In C++, which of the following is important in a function? Function name and return type Return Type Function name Parameter list Function name and return type
Which of the following function is used to accept user inputs? round cout return cin cin
It refers to the information that can be passed to a function Syntax Variable Parameter Statement Parameter
Which of the following function declaration using the default argument is correct? int foo(int x=5, int y, int z=10) all are correct int foo(int x, int y =5, int z=10) int foo(int x=5, int y =10, int z) int foo(int x, int y =5, int z=10)
Which value will it take when both user and default values are given? Default value None of the mentioned Custom value User value Custom value
When will we use the function overloading? Same function name but same number of arguments Same function name but different number of arguments Different function name but different number of arguments Different function name but same number o Same function name but different number of arguments
Which of the following returns an integer? int myRoundedGrade(int x) void myFinalGrade(int x, int y) double myAverageGrade(double x) void myInitialGrade(int x) int myRoundedGrade(int x)
Where does the “return statement” return the execution of the program? Group of answer choices main function caller function same function none of the given caller function
A function can return a value by calling using the keyword _____________ Group of answer choices void goto break return return
Which of the following does return a character? Group of answer choices void myGrade(int x, int y) int myGrade (double p, double q, double r) char myGrade(int x) double myGrade (double p, double q) char
If we start our function call with default arguments, then what will be the proceeding arguments? constant arguments user arguments empty arguments default arguments empty arguments
Where should default parameters appear in a function prototype? Middle of the parameter list Anywhere inside the parameter list To the rightmost side of the parameter list To the leftmost side of the parameter list To the rightmost side of the parameter list
What are the mandatory parts of a function declaration? parameter function name and return type variables return type, function name, parameters function name and return type
In C++, the block of code begins and ends with: {} [] () <> {}
The main function in C++ is __________________. int main() void main (String[] args) main (String [] args) Main (String [] args) int main()
It is the actual name of the function Return Type Parameters Function name Function body Function name
Which of the following function gets the ceiling of a number? Group of answer choices Ceils ceiling Ceil ceil ceil
A type of variable inside a function Constant Global Local Foreign Local
Which of the following is a valid function call (assuming the function exists)? functCall; int functCall(); functCall x, y; functCall(); functCall();
What will happen when we use a void in argument passing? Error It will ask for an input It will not return a value to its caller It will return value to its caller It will not return a value to its caller
The function that returns no value is known as null static private function void function void function
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; } Group of answer choices 12
Where does the default parameter can be placed by the user? Leftmost middle none of the mentioned rightmost rightmost
What is the value that is returned in the following function? int getVolume() { int v; v = 23; if (v < 50) { return 50; } return v; } Group of answer choices 50 150 73 23 50
Where should default parameters appear in a function prototype? Anywhere inside the parameter list To the rightmost side of the parameter list Middle of the parameter list To the leftmost side of the parameter list To the rightmost side of the parameter list
A function that calls itself is a __________ function recursive overloaded void main recursive
What is the default argument of b in the function? int sum(int a, int b=10, int c=20); Group of answer choices 10 0 error 20 10
Two or more functions having the same name but different argument(s) are known as: main function overloaded function void function recursive function overloaded function
Which if the following is a way to pass an argument in C++? Call by Goto keyword Call by Reference Call by Value Call by Value and Call by Reference Call by Value and Call by Reference
If the user didn’t supply a value in a function, then what value will it take? none of the mentioned 0 rise an error default value default value
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; } Group of answer choices 20
A function may return a value (produce a value) or may perform some action without returning a value. True or False? True
Functions that do not return a value are called ______ functions. void
C++ comes with libraries of ________ functions that you can use in your programs. predefined
The following functions: abs, labs, fabs are valid functions in C++. True or False? True
C++ does not allow programmers to define their own functions. True or False? False, C++ allows programmers to define their own functions.
A __________ function groups code to perform a specific task and that group of code is given a name (identifier). user-defined
A function name is called a/an _______. identifier
When the function is _______ from any part of program, it executes the codes defined in the body of function. invoked / called
When a program runs, the system calls the _______ function, that is, the system starts executing codes from _______ function. main() and main()
How many minimum numbers of functions need to be present in a C++ program? Only one, the main() function.
Which of the following functions does NOT use the cmath library? rand(), since it is in <cstdlib>
Created by: Easy Kwatro
Popular Computers sets

 

 



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