wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

TN +2 -LESSON1 FUNCTIONS

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.

The values which are passed to a function definition are called

a)

(a) Subroutines

b)

(b) Arguments

c)

(c) Function

d)

(d) Definition

2.

The small sections of code that are used to perform a particular task is called

a)

(A) Pseudo code

b)

(B) Subroutines

c)

(C) Modules

d)

(D) Files

3.

Which of the following are mandatory to write the type annotations in the function

definition?

a)

(a) < >

b)

(b) ( )

c)

(c) { }

d)

(d) [ ]

4.

Which of the following carries out the instructions defined in the interface?

a)

(a) Compiler

b)

(b) Operating System

c)

(c) Implementation

d)

(d) Interpreter

5.

The functions which will give exact result when same arguments are passed are called

a)

(A) Impure functions

b)

B) Partial Functions

c)

(C) Dynamic Functions

d)

(D) Pure functions

6.

The functions which cause side effects to the arguments passed are called

a)

(A) impure function

b)

(B) Partial Functions

c)

(C) Dynamic Functions

d)

(D) Pure functions

7.

Which of the following defines what an object can do?

a)

(A) Operating System

b)

(B) Compiler

c)

C) Interface

d)

(D) Interpreter

8.

The variables in a function definition are called as

a)

(A) Subroutines

b)

(B) Function

c)

(C) Definition

d)

(D) Parameters

9.

Which of the following is a normal function definition and which is recursive function

definition

i) let sum x y:

return x + y

ii) let disp :

print ‘welcome’

iii) let rec sum num:

if (num!=0) then return num + sum (num-1)

else

return num

a)

i) normal function definition

ii) recursive function

iii) recursive function

b)

i) normal function definition

ii) normal function

iii) recursive function

c)

i) recursive function definition

ii) recursive function

iii) recursive function

d)

i) normal function definition

ii) normal function

iii) normal function

10.

A function definition which call itself is called

a)

Recursive function

b)

Lambda function

c)

parametrized function

d)

non-parameterized function

11.

In Programming languages,

subroutines are called as

a)

Constructors

b)

Iteration

c)

loop

d)

Functions.

12.

___ are expressed using statements of a programming language

a)

Instruction

b)

Algorithms

13.

strlen() is a ____ function

a)

Pure

b)

Impure

14.

Read the following specification carefully

let rec gcd a b:=

if b<>0 then gcd b (a mod b)

else return a

Answer the question: Identify Name of the function

(a)  

15.

Read the following specification carefully

let rec gcd a b:=

if b<>0 then gcd b (a mod b)

else return a

Identify the statement which tells it is a recursive function

(a)  

16.

Read the following specification carefully

let rec gcd a b:=

if b<>0 then gcd b (a mod b)

else return a

Statement which terminates the recursion.

(a)  

17.

Read the following specification carefully

let rec gcd a b:=

if b<>0 then gcd b (a mod b)

else return a

Identify the parameters .

a)

a

b)

b

c)

a,b

d)

gcd

18.

Choose the pure function from the options given below

a)

random( )

b)

date( )

c)

time( )

d)

sin( )

19.

The keyword ___ is used to refer a recursive function in the program code

a)

let

b)

rec

c)

def

d)

function

20.

____ just defines what an object can do, but won't actually do it

a)

interface

b)

implementation

c)

definition

d)

code