wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Functions and Procedures in Programming

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.

What is a function in programming?

a)

A group of commands that can be used repeatedly

b)

A group of commands that can be used once

c)

A type of variable

d)

A method to store data

2.

What does a procedure do?

a)

Creates a new variable

b)

Stores data temporarily

c)

Performs a series of commands without returning a value

d)

Generates a value

3.

What is the purpose of using functions in programming?

a)

To make code longer

b)

To make code harder to read

c)

To reduce repetition and improve organization

d)

To create more errors

4.

What is an example of a procedure?

a)

hitungLuas(panjang, lebar)

b)

maju 100 langkah

c)

gambarSegitiga()

d)

return hasil

5.

What is modularity in coding?

a)

Writing code in one long line

b)

Organizing code into reusable blocks

c)

Making code more complex

d)

Using only variables

6.

What does the function hitungLuas(panjang, lebar) return?

a)

The width of a rectangle

b)

The area of a rectangle

c)

The perimeter of a rectangle

d)

The length of a rectangle

7.

What is the first step in creating a procedure?

a)

Defining the procedure

b)

Returning a value

c)

Creating a variable

d)

Calling the procedure

8.

What is the benefit of fixing a bug in a function?

a)

It only fixes the bug in one place

b)

It fixes the bug everywhere the function is called

c)

It makes the code longer

d)

It creates new bugs

9.

What is an example of a function that does not return a value?

a)

return hasil

b)

maju()

c)

hitungLuas()

d)

gambarSegitiga()

10.

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

a)

To create a loop

b)

To end the function

c)

To pass a value back to the caller

d)

To define the function

11.

What does the term 'block of code' refer to?

a)

A single line of code

b)

A variable

c)

A group of related commands

d)

An error in the code

12.

What is the main advantage of using procedures?

a)

They are harder to understand

b)

They create more errors

c)

They allow for code reuse

d)

They make code longer

13.

What is the output of luas1 in the example provided?

a)

100

b)

50

c)

10

d)

200

14.

What is the purpose of the procedure gambarSegitiga()?

a)

To draw a triangle

b)

To create a variable

c)

To calculate area

d)

To store a value

15.

What is the first command in the procedure gambarSegitiga()?

a)

belok 120 derajat

b)

maju 100 langkah

c)

AKHIR PROSEDUR

d)

return hasil

16.

What is the main focus of the text?

a)

The history of programming

b)

The importance of variables

c)

The types of programming languages

d)

The concept of functions and procedures

17.

What is an example of a task that requires strategic thinking?

a)

Creating a new function to solve a problem

b)

Writing a single line of code

c)

Recalling the definition of a function

d)

Identifying a variable

18.

What is the purpose of the activity mentioned in the text?

a)

To memorize definitions

b)

To practice creating procedures

c)

To learn about variables

d)

To write long programs

19.

What does the term 'reusable code' refer to?

a)

Code that is never used

b)

Code that can be called multiple times

c)

Code that can be copied and pasted

d)

Code that can be used only once

20.

What is the expected output of luas2 in the example provided?

a)

100

b)

50

c)

400

d)

200

21.

What is the main benefit of reducing repetition in code?

a)

It makes the code more efficient

b)

It makes the code harder to read

c)

It creates more errors

d)

It makes the code longer

22.

What is the purpose of the procedure sapaPemain()?

a)

To display a greeting message

b)

To calculate a score

c)

To draw a shape

d)

To create a variable

23.

What is the first step in creating a function?

a)

Creating a variable

b)

Calling the function

c)

Defining the function

d)

Returning a value

24.

What is the main focus of the text regarding functions and procedures?

a)

To list programming languages

b)

To explain their importance in programming

c)

To teach about variables

d)

To describe data types

25.

What is the expected behavior of the procedure lompat()?

a)

To make the character draw

b)

To make the character jump

c)

To make the character run

d)

To make the character sit

26.

What is the significance of the term 'block kustom'?

a)

It refers to a type of variable

b)

It refers to a data type

c)

It refers to a custom block of code

d)

It refers to a programming error

27.

What is the main takeaway from the text?

a)

Functions and procedures are only for advanced programmers

b)

Functions and procedures are unimportant

c)

Functions and procedures help organize code

d)

Functions and procedures are the same as variables

28.

What is the purpose of the example provided in the text?

a)

To illustrate the use of functions and procedures

b)

To show how to write a program

c)

To explain programming languages

d)

To teach about data types

29.

What is the expected output of the function hitungLuas(20, 10)?

a)

10

b)

20

c)

200

d)

50

30.

What is the main advantage of using functions in programming?

a)

They are harder to understand

b)

They create more errors

c)

They help in organizing and reusing code

d)

They make code longer

31.

What is a function in programming?

a)

A group of commands that can be used repeatedly

b)

A group of commands that can be used once

c)

A type of variable

d)

A method to store data

32.

What does a procedure do?

a)

Creates a new variable

b)

Stores data temporarily

c)

Performs a series of commands without returning a value

d)

Generates a value

33.

What is the purpose of using functions in programming?

a)

To make code longer

b)

To make code harder to read

c)

To reduce repetition and improve organization

d)

To create more errors

34.

What is an example of a procedure?

a)

hitungLuas(panjang, lebar)

b)

maju 100 langkah

c)

gambarSegitiga()

d)

return hasil

35.

What is modularity in coding?

a)

Writing code in one long line

b)

Organizing code into reusable blocks

c)

Making code more complex

d)

Using only variables

36.

What does the function hitungLuas(panjang, lebar) return?

a)

The width of a rectangle

b)

The area of a rectangle

c)

The perimeter of a rectangle

d)

The length of a rectangle

37.

What is the first step in creating a procedure?

a)

Defining the procedure

b)

Returning a value

c)

Creating a variable

d)

Calling the procedure

38.

What is the benefit of fixing a bug in a function?

a)

It only fixes the bug in one place

b)

It fixes the bug everywhere the function is called

c)

It makes the code longer

d)

It creates new bugs

39.

What is an example of a function that does not return a value?

a)

return hasil

b)

maju()

c)

hitungLuas()

d)

gambarSegitiga()

40.

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

a)

To create a loop

b)

To end the function

c)

To pass a value back to the caller

d)

To define the function

41.

What does the term 'block of code' refer to?

a)

A single line of code

b)

A variable

c)

A group of related commands

d)

An error in the code

42.

What is the main advantage of using procedures?

a)

They are harder to understand

b)

They create more errors

c)

They allow for code reuse

d)

They make code longer

43.

What is the output of luas1 in the example provided?

a)

100

b)

50

c)

10

d)

200

44.

What is the purpose of the procedure gambarSegitiga()?

a)

To draw a triangle

b)

To create a variable

c)

To calculate area

d)

To store a value

45.

What is the first command in the procedure gambarSegitiga()?

a)

belok 120 derajat

b)

maju 100 langkah

c)

AKHIR PROSEDUR

d)

return hasil

46.

What is the main focus of the text?

a)

The history of programming

b)

The importance of variables

c)

The types of programming languages

d)

The concept of functions and procedures

47.

What is an example of a task that requires strategic thinking?

a)

Creating a new function to solve a problem

b)

Writing a single line of code

c)

Recalling the definition of a function

d)

Identifying a variable

48.

What is the purpose of the activity mentioned in the text?

a)

To memorize definitions

b)

To practice creating procedures

c)

To learn about variables

d)

To write long programs

49.

What does the term 'reusable code' refer to?

a)

Code that is never used

b)

Code that can be called multiple times

c)

Code that can be copied and pasted

d)

Code that can be used only once

50.

What is the expected output of luas2 in the example provided?

a)

100

b)

50

c)

400

d)

200

51.

What is the main benefit of reducing repetition in code?

a)

It makes the code more efficient

b)

It makes the code harder to read

c)

It creates more errors

d)

It makes the code longer

52.

What is the purpose of the procedure sapaPemain()?

a)

To display a greeting message

b)

To calculate a score

c)

To draw a shape

d)

To create a variable

53.

What is the first step in creating a function?

a)

Creating a variable

b)

Calling the function

c)

Defining the function

d)

Returning a value

54.

What is the main focus of the text regarding functions and procedures?

a)

To list programming languages

b)

To explain their importance in programming

c)

To teach about variables

d)

To describe data types

55.

What is the expected behavior of the procedure lompat()?

a)

To make the character draw

b)

To make the character jump

c)

To make the character run

d)

To make the character sit

56.

What is the significance of the term 'block kustom'?

a)

It refers to a type of variable

b)

It refers to a data type

c)

It refers to a custom block of code

d)

It refers to a programming error

57.

What is the main takeaway from the text?

a)

Functions and procedures are only for advanced programmers

b)

Functions and procedures are unimportant

c)

Functions and procedures help organize code

d)

Functions and procedures are the same as variables

58.

What is the purpose of the example provided in the text?

a)

To illustrate the use of functions and procedures

b)

To show how to write a program

c)

To explain programming languages

d)

To teach about data types

59.

What is the expected output of the function hitungLuas(20, 10)?

a)

10

b)

20

c)

200

d)

50

60.

What is the main advantage of using functions in programming?

a)

They are harder to understand

b)

They create more errors

c)

They help in organizing and reusing code

d)

They make code longer