0% found this document useful (0 votes)
6 views

Chapter1 - Functions-12

The document contains a series of questions and answers related to functions in programming, covering topics such as subroutines, parameters, pure and impure functions, and interfaces. It includes multiple-choice questions, definitions, and additional questions for deeper understanding. The content is structured into sections for book back questions, PTA, additional questions, and government exam questions.

Uploaded by

sathish
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Chapter1 - Functions-12

The document contains a series of questions and answers related to functions in programming, covering topics such as subroutines, parameters, pure and impure functions, and interfaces. It includes multiple-choice questions, definitions, and additional questions for deeper understanding. The content is structured into sections for book back questions, PTA, additional questions, and government exam questions.

Uploaded by

sathish
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CHAPTER – 1 – FUNCTION

I. BOOK BACK QUESTIONS:


1. The small sections of code that are used to perform a particular task is called
a) Subroutines b) Files c) Pseudocode d) Modules
2. Which of the following is a unit of code that is often defined within a greater code structure?
a) Subroutines b) Function c) Files d) Modules
3. Which of the following is a distinct syntactic block?
a) Subroutines b) Function c) Definition d) Modules
4. The variables in a function definition are called as
a) Subroutines b) Function c) Definition d) Parameters
5. The values which are passed to a function definition are called
a) Arguments b) Subroutines c) Function d) Definition
6. Which of the following are mandatory to write the type annotations in the function definition?
a) Curly braces b) Parentheses c) Square brackets d) indentations
7. Which of the following defines what an object can do?
a) Operating System b) Compiler c) Interface d) Interpreter
8. Which of the following carries out the instructions defined in the interface?
a) Operating System b) Compiler c) Implementation d) Interpreter
9. The functions which will give exact result when same arguments are passed are called
a) Impure functions b) Partial Functions c) Dynamic Function d) Pure functions
10. The functions which cause side effects to the arguments passed are called
a) impure function b) Partial Functions c) Dynamic Functions d) Pure functions
II. PTA:
1. A function definition which call itself (PTA – 1)
a) Pure function b) Impure function c) Normal function d) Recursive function
III. ADDITIONAL QUESTIONS:
1. In programming languages are called as Functions.
a) Parameters b) Subroutines c) Interfaces d) Algorithm
2. The definition is introduced by the keyword
a) def b) let c) take d) All the above
3. A function definition which call itself is called function.
a) recursive b) nested c) pure d) impure
4. All functions are definitions.
a) dynamic b) static c) recursive d None of these
5. Identify the impure function from the following.
a) sin ( ) b) cos ( ) c) strlen ( ) d) random ( )
6. Match the following:
a) Algorithms - 1) Small section of code
b) Subroutines - 2) Set of code
c) Function - 3) Set of action
d) Interface - 4) Expressed using statements

(a) (b) (c) (d)


(A) 2 3 4 1

(B) 4 3 1 2

(C) 4 1 2 3

(D) 3 4 1 2
7. Which of the following are distinct syntactic blocks?
a) Subroutines b) Algorithms c) Function d) Definitions
IV. PUBLIC & GOVERNMENT EXAM QUESTIONS:
1. Which is the basic building block of computer programs? (Sep – 20)
a) Argument b) Parameter c) Subroutine d) Interface
2. The function which will give exact result when same arguments are passed are called (Mar – 20)
a) Impure functions b) Partial functions c) Dynamic functions d) Pure functions

I. BOOK BACK QUESTIONS:


1. What is a subroutine?
2. Define function with respect to Programming language.
3. Write the interface you get from X:=( 78).
4. Differentiate interface and the implementation .
5. Which of the following is a normal function definition and which is recursive function definition?

i) let rec sum x y: ii) let disp: iii) let rec sum num:
return x + y print ‘welcome’ if (num!=0) then return num+sum(num-1)

else

return num

BOOK BACK QUESTIONS:


1. Mention the characteristics of Interface.
2. Why strlen is called pure function?
3. hat is the side effect of impure function? Give example.
4. Differentiate pure and impure function .
5. What happens if you modify a variable outside the function? Give an example.
II. PTA :
1. Write a function that finds the minimum of its three arguments. (PTA - 4)
III. GOVERNMENT QUESTIONS:
1. Mention the characteristics of interface. (Sep - 20)
2. Differentiate Pure and Impure. (Mar - 20)

I. BOOK BACK QUESTIONS:


1. What are called Parameters and write a note on
i) Parameter without Type ii) Parameter with Type
2. Identify in the following
program. let rec gcd a
b :=
if b < > 0 then gcd b (a mod b) else return a
i) Name of the function
ii) Identify the statement which tells it is a recursive function
iii) Name of the argument variable
iv) Statement which invoke the function recursively
v) Statement which terminates the recursion
3. Explain with example Pure and impure functions.
4. Explain with an example interface and the implementation.

You might also like