Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Functions and Data Abstraction - Multiple Choice Questions

Total questions: 100

Worksheet time: 50mins

Name
Class
Date
1.

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

a)

Subroutines

b)

Files

c)

Pseudo code

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)

{ }

b)

( )

c)

[ ]

d)

<>

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 Functions

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

11.

Which of the following functions that build the abstract data type?

a)

Constructors

b)

Destructors

c)

recursive

d)

Nested

12.

Which of the following functions that retrieve information from the data type?

a)

Constructors

b)

Selectors

c)

recursive

d)

Nested

13.

The data structure which is a mutable ordered sequence of elements is called

a)

Built in

b)

List

c)

Tuple

d)

Derived data

14.

A sequence of immutable objects is called

a)

Built in

b)

List

c)

Tuple

d)

Derived data

15.

The data type whose representation is known are called

a)

Built in datatype

b)

Derived datatype

c)

Concrete datatype

d)

Abstract datatype

16.

The data type whose representation is unknown are called

a)

Built in datatype

b)

Derived datatype

c)

Concrete datatype

d)

Abstract datatype

17.

Which of the following is a compound structure?

a)

Pair

b)

Triplet

c)

single

d)

quadrat

18.

Bundling two values together into one can be considered as

a)

Pair

b)

Triplet

c)

single

d)

quadrat

19.

9. The feature that allows you to name the various parts of a multi-item object is called:

a)

Labels

b)

Indexes

c)

Pointers

d)

References

20.

Which of the following is constructed by placing expressions within square brackets?

a)

Tuples

b)

Lists

c)

Classes

d)

quadrats

21.

Which of the following refers to the visibility of variables in one part of a program to another part of the same program?

a)

Scope

b)

Memory

c)

Address

d)

Accessibility

22.

The process of binding a variable name with an object is called

a)

Scope

b)

Mapping

c)

late binding

d)

early binding

23.

Which of the following is used in programming languages to map the variable and object?

a)

::

b)

:=

c)

=

d)

==

24.

Containers for mapping names of variables to objects is called

a)

Scope

b)

Mapping

c)

Binding

d)

Namespaces

25.

Which scope refers to variables defined in current function?

a)

Local Scope

b)

Global scope

c)

Module scope

d)

Function Scope

26.

The process of subdividing a computer program into separate sub-programs is called

a)

Procedural Programming

b)

Modular programming

c)

Event Driven Programming

d)

Object oriented Programming

27.

Which of the following security technique that regulates who can use resources in a computing environment?

a)

Password

b)

Authentication

c)

Access control

d)

Certification

28.

Which of the following members of a class can be handled only from within the class?

a)

Public members

b)

Protected members

c)

Secured members

d)

Private members

29.

Which members are accessible from outside the class?

a)

Public members

b)

Protected members

c)

Secured members

d)

Private members

30.

The members that are accessible from within the class and are also available to its sub-classes is called

a)

Public members

b)

Protected members

c)

Secured members

d)

Private members

31.

The word comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi is called?

a)

Flowchart

b)

Flow

c)

Algorithm

d)

Syntax

32.

From the following sorting algorithms which algorithm needs the minimum number of swaps?

a)

Bubble sort

b)

Insertion sort

c)

Selection sort

d)

All the above

33.

Two main measures for the efficiency of an algorithm are

a)

Processor and memory

b)

Complexity and capacity

c)

Time and space

d)

Data and space

34.

The algorithm that yields expected output for a valid input is called as

a)

Algorithmic solution

b)

Algorithmic outcomes

c)

Algorithmic problem

d)

Algorithmic coding

35.

Which of the following is used to describe the worst case of an algorithm?

a)

Big A

b)

Big S

c)

Big W

d)

Big O

36.

Big O is the reverse of

a)

Big O

b)

Big Θ

c)

Big A

d)

Big S

37.

Binary search is also called as

a)

Linear search

b)

Sequential search

c)

Random search

d)

Half-interval search

38.

The Θ notation in asymptotic evaluation represents

a)

Base case

b)

Average case

c)

Worst case

d)

NULL case

39.

If a problem can be broken into sub problems which are reused several times, the problem possesses which property?

a)

Overlapping subproblems

b)

Optimal substructure

c)

Memoization

d)

Greedy

40.

In dynamic programming, the technique of storing the previously calculated values is called?

a)

Saving value property

b)

Storing value property

c)

Memoization

d)

Mapping

41.

Who developed Python?

a)

Ritche

b)

Guido Van Rossum

c)

Bill Gates

d)

Sunder Pichai

42.

The Python prompt indicates that Interpreter is ready to accept instruction.

a)

A) >>>

b)

B) <<<

c)

C) #

d)

D) <<

43.

Which of the following shortcut is used to create new Python Program?

a)

Ctrl + C

b)

Ctrl + F

c)

Ctrl + B

d)

Ctrl + N

44.

Which of the following character is used to give comments in Python Program?

a)

#

b)

&

c)

@

d)

$

45.

This symbol is used to print more than one item on a single line.

a)

Semicolon(;)

b)

Dollor($)

c)

comma(,)

d)

Colon(:)

46.

Which of the following is not a token?

a)

Interpreter

b)

Identifiers

c)

Keyword

d)

Operators

47.

Which of the following is not a Keyword in Python?

a)

break

b)

while

c)

continue

d)

operators

48.

Which operator is also called as Comparative operator?

a)

Arithmetic

b)

Relational

c)

Logical

d)

Assignment

49.

Which of the following is not Logical operator?

a)

and

b)

or

c)

not

d)

Assignment

50.

Which operator is also called as Conditional operator?

a)

Ternary

b)

Relational

c)

Logical

d)

Assignment

51.

How many important control structures are there in Python?

a)

3

b)

4

c)

5

d)

6

52.

elif can be considered to be abbreviation of

a)

nested if

b)

if..else

c)

else if

d)

if..elif

53.

What plays a vital role in Python programming?

a)

Statements

b)

Control

c)

Structure

d)

Indentation

54.

Which statement is generally used as a placeholder?

a)

continue

b)

break

c)

pass

d)

goto

55.

The condition in the if statement should be in the form of

a)

Arithmetic or Relational expression

b)

Arithmetic or Logical expression

c)

Relational or Logical expression

d)

Arithmetic

56.

Which of the following is known as definite loop?

a)

do..while

b)

while

c)

for

d)

if..elif

57.

What is the output of the following snippet? i=1

while True:

if i%3 ==0: break print(i,end="") i +=1

a)

A) 12

b)

B) 123

c)

C) 1234

d)

D) 124

58.

What is the output of the following snippet? T=1 while T: print(True) break

a)

False

b)

True

c)

0

d)

1

59.

Which amongst this is not a jump statement?

a)

for

b)

pass

c)

continue

d)

break

60.

Which punctuation should be used in the blank?

if <CONDITION>_

statements-block 1

else:

statements-block 2

a)

:

b)

::

c)

!

d)

:

61.

A named blocks of code that are designed to do one specific job is called as

a)

Loop

b)

Branching

c)

Function

d)

Block

62.

A Function which calls itself is called as

a)

Built-in

b)

Recursion

c)

Lambda

d)

return

63.

Which function is called anonymous un-named function?

a)

Lambda

b)

Recursion

c)

Function

d)

define

64.

Which of the following keyword is used to begin the function block?

a)

define

b)

for

c)

finally

d)

def

65.

Which of the following keyword is used to exit a function block?

a)

define

b)

return

c)

finally

d)

def

66.

While defining a function which of the following symbol is used.

a)

; (semicolon)

b)

. (dot)

c)

: (colon)

d)

$ (dollar)

67.

In which arguments the correct positional order is passed to a function?

a)

Required

b)

Keyword

c)

Default

d)

Variable-length

68.

In Python, you don’t have to mention the specific data types while defining function. Python keywords can be used as function name.

a)

I is correct and II is wrong

b)

Both are correct

c)

I is wrong and II is correct

d)

Both are wrong

69.

Pick the correct one to execute the given statement successfully. if _____ : print(x, " is a leap year")

a)

x%2=0

b)

x%4==0

c)

x/4=0

d)

x%4=0

70.

Which of the following keyword is used to define the function testpython()?

a)

define

b)

pass

c)

def

d)

while

71.

Which of the following is the output of the following python code? str1="TamilNadu" print(str1[::-1])

a)

Tamilnadu

b)

Tmlau

c)

udanlimaT

d)

udaNlimaT

72.

What will be the output of the following code? str1 = "Chennai Schools" str1[7] = "-"

a)

Chennai-Schools

b)

Chenna-School

c)

Type error

d)

Chennai

73.

Which of the following operator is used for concatenation?

a)

+

b)

&

c)

*

d)

=

74.

Defining strings within triple quotes allows creating:

a)

Single line Strings

b)

Multiline Strings

c)

Double line Strings

d)

Multiple Strings

75.

Strings in python:

a)

Changeable

b)

Mutable

c)

Immutable

d)

flexible

76.

Which of the following is the slicing operator?

a)

{ }

b)

[ ]

c)

<>

d)

( )

77.

What is stride?

a)

index value of slide operation

b)

first argument of slice operation

c)

second argument of slice operation

d)

third argument of slice operation

78.

Which of the following formatting character is used to print exponential notation in upper case?

a)

%e

b)

%E

c)

%g

d)

%n

79.

Which of the following is used as placeholders or replacement fields which get replaced along with format( ) function?

a)

{ }

b)

<>

c)

++

d)

12\frac{1}{2}

80.

The subscript of a string may be:

a)

Positive

b)

Negative

c)

Both (a) and (b)

d)

Either (a) or (b)

81.

Pick odd one in connection with collection data type

a)

List

b)

Tuple

c)

Dictionary

d)

Loop

82.

Let list1=[2,4,6,8,10], then print(List1[-2]) will result in

a)

10

b)

8

c)

4

d)

6

83.

Which of the following function is used to count the number of elements in a list?

a)

count()

b)

find()

c)

len()

d)

index()

84.

If List=[10,20,30,40,50] then List[2]=35 will result

a)

[35,10,20,30,40,50]

b)

[10,20,30,40,50,35]

c)

[10,20,35,40,50]

d)

[10,35,30,40,50]

85.

If List=[17,23,41,10] then List.append(32) will result

a)

[32,17,23,41,10]

b)

[17,23,41,10,32]

c)

[10,17,23,32,41]

d)

[41,32,23,17,10]

86.

Which of the following Python function can be used to add more than one element within an existing list?

a)

append()

b)

append_more()

c)

extend()

d)

more()

87.

What will be the result of the following Python code? S=[x**2 for x in range(5)] print(S)

a)

[0,1,2,4,5]

b)

[0,1,4,9,16]

c)

[0,1,4,9,16,25]

d)

[1,4,9,16,25]

88.

What is the use of type() function in python?

a)

To create a Tuple

b)

To know the type of an element in tuple.

c)

To know the data type of python object.

d)

To create a list.

89.

Which of the following statement is not correct?

a)

A list is mutable

b)

A tuple is immutable.

c)

The append() function is used to add an element.

d)

The extend() function is used in tuple to add elements in a list.

90.

Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet? print(setA|setB)

a)

{3,6,9,1,3,9}

b)

{3,9}

c)

{1}

d)

{1,3,6,9}

91.

Which of the following set operation includes all the elements that are in two sets but not the one that are common to two sets?

a)

Symmetric difference

b)

Difference

c)

Intersection

d)

Union

92.

The keys in Python, dictionary is specified by

a)

=

b)

:

c)

+

d)

;

93.

Which of the following are the key features of an Object Oriented Programming language?

a)

Constructor and Classes

b)

Constructor and Object

c)

Classes and Objects

d)

Constructor and Destructor

94.

Functions defined inside a class:

a)

Functions

b)

Module

c)

Methods

d)

section

95.

Class members are accessed through which operator?

a)

&

b)

.

c)

#

d)

%

96.

Which of the following method is automatically executed when an object is created?

a)

__object__()

b)

__del__()

c)

__func__()

d)

__init__()

97.

A private class variable is prefixed with

a)

__

b)

&&

c)

##

d)

**

98.

Which of the following method is used as destructor?

a)

__init__()

b)

__dest__()

c)

__rem__()

d)

__del__()

99.

Which of the following class declaration is correct?

a)

classclass_name

b)

class class_name<>

c)

class class_name:

d)

class class_name[ ]

100.

Which of the following is the output of the following program? class Student: def __init__(self, name): self.name=name print (self.name) S=Student("Tamil")

a)

Error

b)

Tamil

c)

name

d)

self