TOTAL TIME: 3 HOURS TOTAL MARKS: 100
(PART ONE: 40; PART TWO: 60)
PART ONE
(Answer all the questions; each question carries one mark)
Each question below gives a multiple choice of answers. Choose the most appropriate one.
1.1 The diagrammatic representation of an algorithm is एल्गोरिथम का आरेखीय निरूपण है:
a) Flow chart
b) Pseudo code
c) Chart
d) Graph
Ans: (a) Flow chart
1.2 Debugging is used to
a) Black box testing
b) Check the functionality of the program
c) Find error from the program
d) None of Above
Ans: (C) Find error from the program
1.3 Which of the following cannot be a variable?
a) _init_
b) In
c) It
d) On
Ans: (b) in
1.4 Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned
Ans: (b) //
1.5 What is output of the following program?
a=18.6
b=6
print a//b
a) 3.1
b) 6.0
c) 18.0
d) None of above
Ans: (b) 6.0
1.6 What is output of the following program?
a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)
a) [13,56, 17,87,[45,67]]
b) [13, 56, 17, 87, 45, 67]
c) [13, 56, 17, [87], 45, 67]
d) None of Above
Ans: (c) [13, 56, 17, [87], 45, 67]
1.7 What type of Data is :
A=[(1,1),(2,4),(3,9)]?
a) Array of tuples
b) List of tuples
c) Tuples of lists
d) Invalid type
Ans: (b) List of tuples
1.8 What will be the output of the following Python code?
def cube (x):
return x*x*x
x=cube(5)
print(x)
a) 26
b) 525
c) 125
d) None of these
Ans: (c) 125
1.9 Which of the following mode will refer to binary data?
a) r
b) w
c) +
d) b
Ans: (d)
1.10 What is the output of following program?
import numpy as np
ary=np.array([1,2,3,5,8])
ary=ary+1
print (ary[1])
a) 3
b) 2
c) 5
d) None of Above
Ans: (a)
2. Each statement below is either TRUE or False. Choose the most appropriate one.
2.1 Numpy is a tool for data visualization (F)
2.2 Local can be inside a function or class method (T)
2.3 The read method starts reading from the beginning of the file (T)
2.4 By using functions, we can avoid rewriting same code again and again in a program (T)
2.5 Tuples faster than lists (T)
2.6 The output of this expression 3*1**3 is 3 (T)
2.7 char is a valid data type in python (F)
2.8 It is mandatory to have _ main_function in python (F)
2.9 The process of writing a program is called programming (T)
2.10 A decision box is represented by a rectangular shape. (F)
3. Match the following:
4. Fill in blanks:
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 ……………………is also known as the alias array.
4.4 ………………… can have various functions and classes.
4.5 ………………..get the current position within the file.
4.6 Modules are files saved with ------------extension
4.7 In python, --------------- is not supported.
4.8 ------------- statement ends the current interation of the loop and continues with the next one.
4.9 Using --------------function we can convert other type to string type.
4.10 The diamond shape symbol is used to place a condition in the program.
Answer: 4.1- a, 4.2- g, 4.3-p,4.4-k, 4.5-q, 4.6-n, 4.7-o, 4.8-b, 4.9-f, 4.10-h
PART TWO (Answer any four questions)
Q5.
a. Draw a flow chart to print the factorials of numbers from 1 to n where n is entered by user.
b. What is Debugging? Explain the way to find out logical errors.
c. What is a NumPy array.
Q6.
a. Write a program to find factorial of given number with recursion.
b. Write a program to print sum of n natural numbers.
c. Explain break and continue statement with example.
Q7.
a. Write code snippets in Python to perform Accessing Elements of a Tuple.
b. Illustrate the LEGB rules and its significance with help of suitable diagram.
c. Define NumPy? How to create NumPy Array?
Q8.
a. Write the basic steps required by the interpreter to execute a python program.
b. Explain the following: -
1. List Slicing
2. List Accessing Methods
Q9.
a. Explain the slicing with example.
b. File handling mean
c. Pass statement
d. For loop
e. Testing and debugging the program
Comments