Folder101   Home Notes Quiz Assigns Info  
Forum Forum
101 Home 101
 
  C++ Level 2

Practice Quiz 5 - Orgainizing Code in Functions


There are 10 questions in this quiz

Question 1: Multiple Choice       

Which one of the following is not a valid function declaration?

Choice 1 int func1(int a, float b, double c);
Choice 2 int func1(int, float, double);
Choice 3 int func1(int a, float b, double c)
Choice 4 func1(int a, float b, double c);

Question 2: Multiple Choice       

Which of the following statements about a function prototype is true?.

Choice 1 a prototype tells the compiler the return type, name, and parameter list
Choice 2 a prototype contains the function code
Choice 3 a prototype tells the compiler the return type only
Choice 4 a prototype cannot be declared in a header file

Question 3: Multiple Choice       

Creating a function consists of defining

Choice 1 a function body and function header
Choice 2 a function prototype only
Choice 3 a function definition only
Choice 4 a function prototype and function definition

Question 4: Multiple Choice      

If you don't declare a return value in a function, what type of return value is assumed?

Choice 1 int
Choice 2 float
Choice 3
void
Choice 4 char

Question 5: Multiple Choice       

Which one of the following statements is FALSE?

Choice 1 functions eliminate the need for duplicate statements.
Choice 2 a function call branches code execution to a function
Choice 3 quite often, function prototypes are declared in header files
Choice 4 you have to include the prototypes for pre-defined functions

Question 6: Multiple Choice     

In the function heading below, what type of value is returned ?

      double func1(float f, int x)

Choice 1 float
Choice 2 int
Choice 3 double
Choice 4 void

Question 7: Multiple Choice       

A value that a function call supplies to the function is known as a(n)

Choice 1 argument
Choice 2 parameter
Choice 3 variable
Choice 4 constant

Question 8: Multiple Choice       

When the type of a function is defined as void, this indicates

Choice 1 a value of false is returned
Choice 2 a return value is not required
Choice 3 a value of true is returned
Choice 4 0 is returned

Question 9: Multiple Choice       

What will be output to the console from the following code?

      void main( )
      {
            int x;
            x = f(4);
            cout << x;
      }

      int f(int temp)
      {
            return temp + 7;
      }

Choice 1 9
Choice 2 10
Choice 3 11
Choice 4 temp

Question 10: Multiple Choice       

What will be output to the console from the following code?

      void main( )
      {
         int z = 6;
         int x = f(z);
         x = f(x);
         cout << x;
      }

      int f(int temp)
      {
         return temp - 3;
      }

Choice 1 3
Choice 2 0
Choice 3 x
Choice 4 temp - 3