C++ Functions and Variables Quiz

C++ Functions and Variables Quiz

9th - 12th Grade

15 Qs

quiz-placeholder

Similar activities

Subprograme

Subprograme

10th Grade

20 Qs

The Barcode scanner

The Barcode scanner

9th - 11th Grade

20 Qs

JAVA QUIZ

JAVA QUIZ

1st - 12th Grade

11 Qs

C++ Arrays

C++ Arrays

8th - 12th Grade

12 Qs

Quiz Bee - META Grade 9

Quiz Bee - META Grade 9

9th Grade

20 Qs

Parcial Laboratorio I (JS)

Parcial Laboratorio I (JS)

10th Grade

20 Qs

PH Prakarya 1

PH Prakarya 1

1st - 10th Grade

20 Qs

OOP 1.TM C programiranje drugi kviz

OOP 1.TM C programiranje drugi kviz

11th Grade

18 Qs

C++ Functions and Variables Quiz

C++ Functions and Variables Quiz

Assessment

Quiz

Science

9th - 12th Grade

Medium

Created by

Fidaa Abed

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?