NEW
Font size
WorksheetsQuiz on Functions and Procedures in Programming
Total questions: 60
Worksheet time: 30mins
What is a function in programming?
A group of commands that can be used repeatedly
A group of commands that can be used once
A type of variable
A method to store data
What does a procedure do?
Creates a new variable
Stores data temporarily
Performs a series of commands without returning a value
Generates a value
What is the purpose of using functions in programming?
To make code longer
To make code harder to read
To reduce repetition and improve organization
To create more errors
What is an example of a procedure?
hitungLuas(panjang, lebar)
maju 100 langkah
gambarSegitiga()
return hasil
What is modularity in coding?
Writing code in one long line
Organizing code into reusable blocks
Making code more complex
Using only variables
What does the function hitungLuas(panjang, lebar) return?
The width of a rectangle
The area of a rectangle
The perimeter of a rectangle
The length of a rectangle
What is the first step in creating a procedure?
Defining the procedure
Returning a value
Creating a variable
Calling the procedure
What is the benefit of fixing a bug in a function?
It only fixes the bug in one place
It fixes the bug everywhere the function is called
It makes the code longer
It creates new bugs
What is an example of a function that does not return a value?
return hasil
maju()
hitungLuas()
gambarSegitiga()
What is the purpose of the return statement in a function?
To create a loop
To end the function
To pass a value back to the caller
To define the function
What does the term 'block of code' refer to?
A single line of code
A variable
A group of related commands
An error in the code
What is the main advantage of using procedures?
They are harder to understand
They create more errors
They allow for code reuse
They make code longer
What is the output of luas1 in the example provided?
100
50
10
200
What is the purpose of the procedure gambarSegitiga()?
To draw a triangle
To create a variable
To calculate area
To store a value
What is the first command in the procedure gambarSegitiga()?
belok 120 derajat
maju 100 langkah
AKHIR PROSEDUR
return hasil
What is the main focus of the text?
The history of programming
The importance of variables
The types of programming languages
The concept of functions and procedures
What is an example of a task that requires strategic thinking?
Creating a new function to solve a problem
Writing a single line of code
Recalling the definition of a function
Identifying a variable
What is the purpose of the activity mentioned in the text?
To memorize definitions
To practice creating procedures
To learn about variables
To write long programs
What does the term 'reusable code' refer to?
Code that is never used
Code that can be called multiple times
Code that can be copied and pasted
Code that can be used only once
What is the expected output of luas2 in the example provided?
100
50
400
200
What is the main benefit of reducing repetition in code?
It makes the code more efficient
It makes the code harder to read
It creates more errors
It makes the code longer
What is the purpose of the procedure sapaPemain()?
To display a greeting message
To calculate a score
To draw a shape
To create a variable
What is the first step in creating a function?
Creating a variable
Calling the function
Defining the function
Returning a value
What is the main focus of the text regarding functions and procedures?
To list programming languages
To explain their importance in programming
To teach about variables
To describe data types
What is the expected behavior of the procedure lompat()?
To make the character draw
To make the character jump
To make the character run
To make the character sit
What is the significance of the term 'block kustom'?
It refers to a type of variable
It refers to a data type
It refers to a custom block of code
It refers to a programming error
What is the main takeaway from the text?
Functions and procedures are only for advanced programmers
Functions and procedures are unimportant
Functions and procedures help organize code
Functions and procedures are the same as variables
What is the purpose of the example provided in the text?
To illustrate the use of functions and procedures
To show how to write a program
To explain programming languages
To teach about data types
What is the expected output of the function hitungLuas(20, 10)?
10
20
200
50
What is the main advantage of using functions in programming?
They are harder to understand
They create more errors
They help in organizing and reusing code
They make code longer
What is a function in programming?
A group of commands that can be used repeatedly
A group of commands that can be used once
A type of variable
A method to store data
What does a procedure do?
Creates a new variable
Stores data temporarily
Performs a series of commands without returning a value
Generates a value
What is the purpose of using functions in programming?
To make code longer
To make code harder to read
To reduce repetition and improve organization
To create more errors
What is an example of a procedure?
hitungLuas(panjang, lebar)
maju 100 langkah
gambarSegitiga()
return hasil
What is modularity in coding?
Writing code in one long line
Organizing code into reusable blocks
Making code more complex
Using only variables
What does the function hitungLuas(panjang, lebar) return?
The width of a rectangle
The area of a rectangle
The perimeter of a rectangle
The length of a rectangle
What is the first step in creating a procedure?
Defining the procedure
Returning a value
Creating a variable
Calling the procedure
What is the benefit of fixing a bug in a function?
It only fixes the bug in one place
It fixes the bug everywhere the function is called
It makes the code longer
It creates new bugs
What is an example of a function that does not return a value?
return hasil
maju()
hitungLuas()
gambarSegitiga()
What is the purpose of the return statement in a function?
To create a loop
To end the function
To pass a value back to the caller
To define the function
What does the term 'block of code' refer to?
A single line of code
A variable
A group of related commands
An error in the code
What is the main advantage of using procedures?
They are harder to understand
They create more errors
They allow for code reuse
They make code longer
What is the output of luas1 in the example provided?
100
50
10
200
What is the purpose of the procedure gambarSegitiga()?
To draw a triangle
To create a variable
To calculate area
To store a value
What is the first command in the procedure gambarSegitiga()?
belok 120 derajat
maju 100 langkah
AKHIR PROSEDUR
return hasil
What is the main focus of the text?
The history of programming
The importance of variables
The types of programming languages
The concept of functions and procedures
What is an example of a task that requires strategic thinking?
Creating a new function to solve a problem
Writing a single line of code
Recalling the definition of a function
Identifying a variable
What is the purpose of the activity mentioned in the text?
To memorize definitions
To practice creating procedures
To learn about variables
To write long programs
What does the term 'reusable code' refer to?
Code that is never used
Code that can be called multiple times
Code that can be copied and pasted
Code that can be used only once
What is the expected output of luas2 in the example provided?
100
50
400
200
What is the main benefit of reducing repetition in code?
It makes the code more efficient
It makes the code harder to read
It creates more errors
It makes the code longer
What is the purpose of the procedure sapaPemain()?
To display a greeting message
To calculate a score
To draw a shape
To create a variable
What is the first step in creating a function?
Creating a variable
Calling the function
Defining the function
Returning a value
What is the main focus of the text regarding functions and procedures?
To list programming languages
To explain their importance in programming
To teach about variables
To describe data types
What is the expected behavior of the procedure lompat()?
To make the character draw
To make the character jump
To make the character run
To make the character sit
What is the significance of the term 'block kustom'?
It refers to a type of variable
It refers to a data type
It refers to a custom block of code
It refers to a programming error
What is the main takeaway from the text?
Functions and procedures are only for advanced programmers
Functions and procedures are unimportant
Functions and procedures help organize code
Functions and procedures are the same as variables
What is the purpose of the example provided in the text?
To illustrate the use of functions and procedures
To show how to write a program
To explain programming languages
To teach about data types
What is the expected output of the function hitungLuas(20, 10)?
10
20
200
50
What is the main advantage of using functions in programming?
They are harder to understand
They create more errors
They help in organizing and reusing code
They make code longer
