C++ Functions and Recursion Test: Chapter 6

SimplestWilliamsite7183 avatar
SimplestWilliamsite7183
·
·
Download

Start Quiz

Study Flashcards

5 Questions

Which of the following is true about functions?

Functions define specific tasks that can be used at many points in a program.

What can functions do?

Be used as building blocks to create new programs.

Which expression returns the trigonometric sine of $x$?

$\sin(x)$

Which of the following is not included in the math library functions?

$\ln$

What does the function prototype 'double mySqrt(int x);' declare?

Declares a function called mySqrt which takes an integer as an argument and returns a double.

Study Notes

Functions

  • Functions can be used to perform a specific task or set of tasks.
  • Functions can be reused throughout a program, making it more efficient and organized.

Math Library Functions

  • The math library includes functions to perform various mathematical operations, such as trigonometric functions.
  • The expression sin(x) returns the trigonometric sine of x.

Exclusions in Math Library Functions

  • sqrt function is not included in the math library functions by default, but it can be declared separately.

Function Prototypes

  • The function prototype double mySqrt(int x); declares a function named mySqrt that takes an integer x as an argument and returns a double value.

Test your knowledge of C++ functions and an introduction to recursion with this multiple-choice quiz based on the book 'C++ How to Program, 10/e, Global Edition'. This quiz covers program components in C++ and includes questions about function definitions, function calls, visibility of function definitions, and function implementation.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser