What is the purpose of the return statement in a function?

C++ Functions and Variables Quiz

Quiz
•
Science
•
9th - 12th Grade
•
Medium
Fidaa Abed
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
To define the function
To terminate the program
To return a value to the calling function
To initialize variables
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the return type of the pow function in C++?
int
float
double
void
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements correctly defines a function that returns an integer value?
void sum(int a, int b) { return a + b; }
int sum(int a, int b) { return a + b; }
double sum(int a, int b) { return a + b; }
bool sum(int a, int b) { return a + b; }
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which return type should be used if a function needs to return true or false?
int
double
bool
void
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a characteristic of a local variable?
It is accessible by all functions in a program.
It retains its value between function calls.
It exists only while the function is executing.
It is automatically initialized to zero.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens to a local variable once a function ends?
It retains its value.
It gets destroyed.
It becomes a global variable.
It is automatically saved for future use.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main reason to avoid using global variables?
They make programs easier to debug.
They increase execution speed.
They make programs difficult to debug.
They can only be used within the main function.
Create a free account and access millions of resources
Similar Resources on Quizizz
18 questions
OOP 1.TM C programiranje drugi kviz

Quiz
•
11th Grade
11 questions
JAVA QUIZ

Quiz
•
1st - 12th Grade
20 questions
Quiz Bee - META Grade 9

Quiz
•
9th Grade
10 questions
Pretest SPE (1-8-23)

Quiz
•
11th Grade
10 questions
Vectors

Quiz
•
11th Grade
12 questions
C++ References

Quiz
•
6th - 12th Grade
20 questions
PH Prakarya 1

Quiz
•
1st - 10th Grade
15 questions
Programacion Arduino C++

Quiz
•
10th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Science
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade