WorksheetsFunctions and Data Abstraction - Multiple Choice Questions
Total questions: 100
Worksheet time: 50mins
The small sections of code that are used to perform a particular task is called
Subroutines
Files
Pseudo code
Modules
Which of the following is a unit of code that is often defined within a greater code structure?
Subroutines
Function
Files
Modules
Which of the following is a distinct syntactic block?
Subroutines
Function
Definition
Modules
The variables in a function definition are called as
Subroutines
Function
Definition
Parameters
The values which are passed to a function definition are called
Arguments
Subroutines
Function
Definition
Which of the following are mandatory to write the type annotations in the function definition?
{ }
( )
[ ]
<>
Which of the following defines what an object can do?
Operating System
Compiler
Interface
Interpreter
Which of the following carries out the instructions defined in the interface?
Operating System
Compiler
Implementation
Interpreter
The functions which will give exact result when same arguments are passed are called
Impure functions
Partial Functions
Dynamic Functions
Pure functions
The functions which cause side effects to the arguments passed are called
impure function
Partial Functions
Dynamic Functions
Pure functions
Which of the following functions that build the abstract data type?
Constructors
Destructors
recursive
Nested
Which of the following functions that retrieve information from the data type?
Constructors
Selectors
recursive
Nested
The data structure which is a mutable ordered sequence of elements is called
Built in
List
Tuple
Derived data
A sequence of immutable objects is called
Built in
List
Tuple
Derived data
The data type whose representation is known are called
Built in datatype
Derived datatype
Concrete datatype
Abstract datatype
The data type whose representation is unknown are called
Built in datatype
Derived datatype
Concrete datatype
Abstract datatype
Which of the following is a compound structure?
Pair
Triplet
single
quadrat
Bundling two values together into one can be considered as
Pair
Triplet
single
quadrat
9. The feature that allows you to name the various parts of a multi-item object is called:
Labels
Indexes
Pointers
References
Which of the following is constructed by placing expressions within square brackets?
Tuples
Lists
Classes
quadrats
Which of the following refers to the visibility of variables in one part of a program to another part of the same program?
Scope
Memory
Address
Accessibility
The process of binding a variable name with an object is called
Scope
Mapping
late binding
early binding
Which of the following is used in programming languages to map the variable and object?
::
:=
=
==
Containers for mapping names of variables to objects is called
Scope
Mapping
Binding
Namespaces
Which scope refers to variables defined in current function?
Local Scope
Global scope
Module scope
Function Scope
The process of subdividing a computer program into separate sub-programs is called
Procedural Programming
Modular programming
Event Driven Programming
Object oriented Programming
Which of the following security technique that regulates who can use resources in a computing environment?
Password
Authentication
Access control
Certification
Which of the following members of a class can be handled only from within the class?
Public members
Protected members
Secured members
Private members
Which members are accessible from outside the class?
Public members
Protected members
Secured members
Private members
The members that are accessible from within the class and are also available to its sub-classes is called
Public members
Protected members
Secured members
Private members
The word comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi is called?
Flowchart
Flow
Algorithm
Syntax
From the following sorting algorithms which algorithm needs the minimum number of swaps?
Bubble sort
Insertion sort
Selection sort
All the above
Two main measures for the efficiency of an algorithm are
Processor and memory
Complexity and capacity
Time and space
Data and space
The algorithm that yields expected output for a valid input is called as
Algorithmic solution
Algorithmic outcomes
Algorithmic problem
Algorithmic coding
Which of the following is used to describe the worst case of an algorithm?
Big A
Big S
Big W
Big O
Big O is the reverse of
Big O
Big Θ
Big A
Big S
Binary search is also called as
Linear search
Sequential search
Random search
Half-interval search
The Θ notation in asymptotic evaluation represents
Base case
Average case
Worst case
NULL case
If a problem can be broken into sub problems which are reused several times, the problem possesses which property?
Overlapping subproblems
Optimal substructure
Memoization
Greedy
In dynamic programming, the technique of storing the previously calculated values is called?
Saving value property
Storing value property
Memoization
Mapping
Who developed Python?
Ritche
Guido Van Rossum
Bill Gates
Sunder Pichai
The Python prompt indicates that Interpreter is ready to accept instruction.
A) >>>
B) <<<
C) #
D) <<
Which of the following shortcut is used to create new Python Program?
Ctrl + C
Ctrl + F
Ctrl + B
Ctrl + N
Which of the following character is used to give comments in Python Program?
#
&
@
$
This symbol is used to print more than one item on a single line.
Semicolon(;)
Dollor($)
comma(,)
Colon(:)
Which of the following is not a token?
Interpreter
Identifiers
Keyword
Operators
Which of the following is not a Keyword in Python?
break
while
continue
operators
Which operator is also called as Comparative operator?
Arithmetic
Relational
Logical
Assignment
Which of the following is not Logical operator?
and
or
not
Assignment
Which operator is also called as Conditional operator?
Ternary
Relational
Logical
Assignment
How many important control structures are there in Python?
3
4
5
6
elif can be considered to be abbreviation of
nested if
if..else
else if
if..elif
What plays a vital role in Python programming?
Statements
Control
Structure
Indentation
Which statement is generally used as a placeholder?
continue
break
pass
goto
The condition in the if statement should be in the form of
Arithmetic or Relational expression
Arithmetic or Logical expression
Relational or Logical expression
Arithmetic
Which of the following is known as definite loop?
do..while
while
for
if..elif
What is the output of the following snippet? i=1
while True:
if i%3 ==0: break print(i,end="") i +=1
A) 12
B) 123
C) 1234
D) 124
What is the output of the following snippet? T=1 while T: print(True) break
False
True
0
1
Which amongst this is not a jump statement?
for
pass
continue
break
Which punctuation should be used in the blank?
if <CONDITION>_
statements-block 1
else:
statements-block 2
:
::
!
:
A named blocks of code that are designed to do one specific job is called as
Loop
Branching
Function
Block
A Function which calls itself is called as
Built-in
Recursion
Lambda
return
Which function is called anonymous un-named function?
Lambda
Recursion
Function
define
Which of the following keyword is used to begin the function block?
define
for
finally
def
Which of the following keyword is used to exit a function block?
define
return
finally
def
While defining a function which of the following symbol is used.
; (semicolon)
. (dot)
: (colon)
$ (dollar)
In which arguments the correct positional order is passed to a function?
Required
Keyword
Default
Variable-length
In Python, you don’t have to mention the specific data types while defining function. Python keywords can be used as function name.
I is correct and II is wrong
Both are correct
I is wrong and II is correct
Both are wrong
Pick the correct one to execute the given statement successfully. if _____ : print(x, " is a leap year")
x%2=0
x%4==0
x/4=0
x%4=0
Which of the following keyword is used to define the function testpython()?
define
pass
def
while
Which of the following is the output of the following python code? str1="TamilNadu" print(str1[::-1])
Tamilnadu
Tmlau
udanlimaT
udaNlimaT
What will be the output of the following code? str1 = "Chennai Schools" str1[7] = "-"
Chennai-Schools
Chenna-School
Type error
Chennai
Which of the following operator is used for concatenation?
+
&
*
=
Defining strings within triple quotes allows creating:
Single line Strings
Multiline Strings
Double line Strings
Multiple Strings
Strings in python:
Changeable
Mutable
Immutable
flexible
Which of the following is the slicing operator?
{ }
[ ]
<>
( )
What is stride?
index value of slide operation
first argument of slice operation
second argument of slice operation
third argument of slice operation
Which of the following formatting character is used to print exponential notation in upper case?
%e
%E
%g
%n
Which of the following is used as placeholders or replacement fields which get replaced along with format( ) function?
{ }
<>
++
21
The subscript of a string may be:
Positive
Negative
Both (a) and (b)
Either (a) or (b)
Pick odd one in connection with collection data type
List
Tuple
Dictionary
Loop
Let list1=[2,4,6,8,10], then print(List1[-2]) will result in
10
8
4
6
Which of the following function is used to count the number of elements in a list?
count()
find()
len()
index()
If List=[10,20,30,40,50] then List[2]=35 will result
[35,10,20,30,40,50]
[10,20,30,40,50,35]
[10,20,35,40,50]
[10,35,30,40,50]
If List=[17,23,41,10] then List.append(32) will result
[32,17,23,41,10]
[17,23,41,10,32]
[10,17,23,32,41]
[41,32,23,17,10]
Which of the following Python function can be used to add more than one element within an existing list?
append()
append_more()
extend()
more()
What will be the result of the following Python code? S=[x**2 for x in range(5)] print(S)
[0,1,2,4,5]
[0,1,4,9,16]
[0,1,4,9,16,25]
[1,4,9,16,25]
What is the use of type() function in python?
To create a Tuple
To know the type of an element in tuple.
To know the data type of python object.
To create a list.
Which of the following statement is not correct?
A list is mutable
A tuple is immutable.
The append() function is used to add an element.
The extend() function is used in tuple to add elements in a list.
Let setA={3,6,9}, setB={1,3,9}. What will be the result of the following snippet? print(setA|setB)
{3,6,9,1,3,9}
{3,9}
{1}
{1,3,6,9}
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?
Symmetric difference
Difference
Intersection
Union
The keys in Python, dictionary is specified by
=
:
+
;
Which of the following are the key features of an Object Oriented Programming language?
Constructor and Classes
Constructor and Object
Classes and Objects
Constructor and Destructor
Functions defined inside a class:
Functions
Module
Methods
section
Class members are accessed through which operator?
&
.
#
%
Which of the following method is automatically executed when an object is created?
__object__()
__del__()
__func__()
__init__()
A private class variable is prefixed with
__
&&
##
**
Which of the following method is used as destructor?
__init__()
__dest__()
__rem__()
__del__()
Which of the following class declaration is correct?
classclass_name
class class_name<>
class class_name:
class class_name[ ]
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")
Error
Tamil
name
self
