Thursday, 15 June 2023

Solved paper Programming and Problem Solving Through Python M3-R5

 Q1 : Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the "OMR" answer sheet supplied with the question paper, following instructions therein.

1.1 : Which of these is not a core data type ?
(A) Lists

(B) Dictionary
(C) Tuples
(D) Class


1.2 : What data type is the object below ? L=[1, 23, 'hello', 1]
(A) List
(B) Dictionary
(C) Tuple
(D) Array

1.3 : Which of the following functions converts a string to a float in python ?
(A) int(x [,base])
(B) long(x [,base])
(C) float(x)
(D) str(x)

1.4 : What is the output of the following program ?

def myfunc(a) :

a=a+2 a=a*2 return a

print myfunc(2)
(A) 8
(B) 16
(C) Indentation Error
(D) Runtime Error

1.5 : What is the output of the expression : 3*1**3 ?
(A) 27
(B) 9
(C) 3
(D) 1

1.6 : What is the output of the following program ?

i=0 while i<3:

print i i+=1

else :

print 0
(A) 0 1 2 3 0
(B) 0 1 2 0
(C) 0 1 2
(D) Error

1.7 : What is the output of the following program ?

print "Hello World"[::-1]

(A) dlroWolleH
(B) Hello Worl
(C) d
(D) Error

1.8 : Given a function that does not return any value, what value is shown when executed at the shell ?

(A) int
(B) bool
(C) void
(D) None

1.9 : What is the output of the following program ?

print 0.1+0.2==0.3

(A) True
(B) False
(C) Machine dependent
(D) Error

1.10 : Given a string s="Welcome", which of the following code is incorrect ?

(A) print s[0]
(B) print s.lower()
(C) s[1]='r'
(D) print s.strip()

Q 2 :  Each statement below is either TRUE or FALSE. Choose the most appropriate one and enter your choice in the "OMR" answer sheet supplied with the question paper, following instructions therein.


2.1 There is no default return value for a function that does not return any value explicitly. 
2.2 Function name and parameter list are part of function header. 
2.3 Brackets enclose the input parameters or arguments of a function. 
2.4 Define keywords marks the beginning of the function block. 
2.5 Python is case sensitive when dealing with identifiers. 
2.6 There is no maximum possible length of an identifier in Python. 
2.7 1st_string is a valid identifier name. 
2.8 Python has no concept of private variables. 
2.9 eval is a keyword in Python.
2.10 All keywords in Python are in lower case.


3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the "OMR" answer sheet supplied with the question paper, following instructions therein.

X

Y

3.1

To take input from the keyboard

A.

Numpy

3.2

Convert a string value to int

B.

Get 1

3.3

Evaluate the value of a string

C.

tell()

3.4

The operator used for concatenating two strings

D.

write()

3.5

Statement used for error checking

E.

Eval 2

3.6

The function used to find power of a number

F.

Tuple

3.7

Array processing package

G.

pow()

3.8

Immutable object

H.

+

3.9

Key value pair

I.

Decryption

3.10

The operator used to calculate remainder after division

J.

Assert

 

 

K.

Queue

 

 

L.

Dictionary

 

 

M.

//



4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Choose the most appropriate option, enter your choice in the "OMR" answer sheet supplied with the question paper, following instructions therein. (1x10)


(A)

*

(B)

Range

(C)

Dictionary

(D)

open

(E)

input

(F)

Random

(G)

Module

(H)

eval

(I)

list

(J)

Convert

(K)

int

(L)

tuples

(M)

Continue

 

 

 

 



4.1 The ______ command is used to take input from the keyboard.
4.2 The  ______ function is used to convert a string value to int.
4.3 The function used to evaluate the value of a string is  ______ .
4.4 The  ______ function takes the parameter file name and the mode during file processing.
4.5 List structure in python where elements are stored in ______ parenthesis.
4.6 The  ______ statement lets the program go through the piece of code without performing any action.
4.7 ______ operator repeats a list for the given number of items.
4.8 ______ is a set of functions you want to include in your application.
4.9 The structure having keys and values is called  ______ .
4.10 The ______ function generates a sequence of numbers from 1 to n.


(Answer any FOUR Questions)


5.
(a) Consider a 3 digit decimal number. Draw a flow chart to print its digits in reverse order. The input is to be taken by user.
(b) Convert decimal no 365.27 to binary number.
(c) Draw a flow chart to evaluate the series of sin(x) upto 5 terms and print 
(5+5+5)

6.
(a) Write a recursive function to find the factorial of a number.
(b) Write a program to check Armstrong numbers in a certain interval.
(c) Write a program to check if the input number is odd or even.
(5+5+5)

7.
Differentiate between the following :
(a) readline() and readlines()
(b) tell() and seek()
(c) Indexing and Slicing 
(5+5+5)

8.
(a) Write complete syntax of following functions and explain their functioning :
(i) rstrip ()
(ii) split ()
(iii) isalpha ()
(iv) pow ()
(b) Write a program code to open a data file. Save element values 2, 4, 9, 10, 11 in this data file and print these data

9.
(a) Write a Python program to get the smallest number from a list.
(b) Write a NumPy program to convert  a Python dictionary to a values by accessing the file. Numpyndarray

 

No comments:

Post a Comment