Formative Assessment 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

built-in

Library functions are also known as _______ function:

colon

Which of the following is NOT included in a function declaration?

void function

A function with no return value is _______________.

parameter

A placeholder of values passed into a function.

int

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?

2

How many parameters are there in the function: int add(int a,int b)?

default value

If the user didn't supply a value in a function, then what value will it take?

parenthesis

In C++, arguments to functions always appear within ______________.

int main ()

In C++, from which function the execution of a C++programs starts?

{}

In C++, the block of code begins and ends with:

function declaration

In C++, the function prototype is also known as _________________________

Pass by valuePass by pointerPass by referenceAll of the above

In C++, variables can be passed to a function by:

Function can have no argument but return value

In C++, which of the following is TRUE?

return

In order to return a value from a function you must use:

arguments can be passed but it does not return any value

In the function void primeNumber (int n); which of the following is NOT true?

parameters

It refers to the information that can be passed to a function

float

The return type of the function float divide (float a, float b)) is :

defined / called

To execute the codes of function, the user-defined function needs to be __________.

return type, function name, parameters

What are the mandatory parts of a function declaration?

error

What is the default argument of b in the function? int sum(int a=10, int b, int c=30);

1 hi

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;}

1

What is the output of the following code? #include <iostream>using namespace std;void f1(){cout <<1<< endl;}int main(){f1();return 0;}

error

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; }

20

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; }

10

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; }

5

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); }

void

What will you use if you do NOT intended to return value?

int

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 and lower targets as an integer. ______ increaseTemperature(int upper, int lower) { return upper - lower; }

when a function is declared

When do we define the default values for a function?

overloading

When two functions with the same name are defined in the same scope, the function is:

Same function name but different number of arguments

When will we use the function overloading?

main function

Where does the "return statement" return the execution of the program?

most left part

Where should default parameters appear in a function prototype?

value, pointers, or reference

Which if the following is a way to pass an argument in C++?

abs

Which of the following computes for the absolute value for int?

void myPassingGrade(int x, int y)

Which of the following doesn't return a value?

ceil

Which of the following function gets the ceiling of a number?

floor

Which of the following function gets the floor of a number?

rand ()

Which of the following functions does NOT use the cmath library?

void myGrade1(int x, int y)

Which of the following has 2 parameters?

func (int x)

Which of the following is NOT a proper function prototype (definition)?

12

`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; }


Ensembles d'études connexes

Chapter 3 Section 1: Benefits of Free Enterprise

View Set

ADMJ 300 key words - chapters 1-14

View Set

H&I 3 - Cardiac (IGGY Study Guide Chapter 31)

View Set

Part 3 - Investment Vehicles (CONSOLIDATED)

View Set

Chapter 26 - Ozone depletion study guide

View Set