1. Each question below gives multiple choices of answers. Choose the most appropriate one.
1.1 The _ provides pictorial representation of given problem.
(a) Algorithm
(b) Flowchart
(c) Pseudocode
(d) All of these
1.2 Which of the following mode will refer to binary data?
(a) r
(b) w
(c) +
(d) b
1.3 The __ symbol is used at the beginning of a flow chart.
(a) Circle/Oval
(b) Rectangle
(c) Diamond
(d) None of these
1.4 What will be the output of the following code: Print type(type(int))
(a) type ‘int’
(b) type ‘type’
(c) error
(d) 0
1.5 what is the output of the following code:L=[‘a’,’b’,’c’,’d’]
Print “”.join[l]
(a) Error
(b) None
(c) abcd
(d) [‘a’,’b’,’c’,’d’]
1.6 Which of the following argument we need to pass in reshape() function?
(a) Array
(b) Shape
(c) Both A and B
(d) None of the above
1.7 What is the output of the code print(9//2)
(a) 4.5
(b) 4.0
(c) 4
(d) Error
1.8 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.9 Which of the following software translates source code into object code?
(a) Compiler
(b) Interpreter
(c) Assembler
(d) None
1.10 Which one of the following is not attributes of file?
(a) closed
(b) softspace
(c) rename
(d) mode
2) State which of the following is True or False:- 1×10=10
No. | Questins | T/F |
2.1 | Numpy is a tool for data visualization. | F |
2.2 | The break statement is used to terminates the current loop and resumes execution at the next statement | T |
2.3 | The scope rule in Python are summarized as ELGB (enclosed, local, global, built-in). | F |
2.4 | Strings in Python are mutable. | F |
2.5 | The symbol used for both input and output is ▱ | T |
2.6 | if list1=[10,20,30], then operation list1*2 returns [20,40,60]. | F |
2.7 | A detailed flowchart is called Micro | T |
2.8 | You cannot obtain a value in a dictionary using a key for a single element. | F |
2.9 | It is mandatory to have main function in python. | T |
2.10 | Python allows you to assign a single value to multiple variables simultaneously. | T |
3) Match the following:- 1×10=10
No. | X | Y |
3.1 | Data structure used in recursion 2 | 1. Numpy |
3.2 | Function takes a list of lines to be written to file 5 | 2. Stack |
3.3 | The function that yields current position in the file 3 | 3. tell() |
3.4 | The operator used for concatenating two strings + | 4. write() |
3.5 | Statement used for error checking 10 | 5. writelines() |
3.6 | The function used to find power of a number 7 | 6. Tuple |
3.7 | Array processing package 1 | 7. pow() |
3.8 | Immutable object 6 | 8. exp() |
3.9 | Key value pair 12 | 9. + |
3.10 | The operator used to calculate remainder after division 14 | 10. Assert |
11. . Queue | ||
12. Dictionary | ||
13. // | ||
14. % |
4) Match the following:- 1×10=10
a) * | b) Range | c) pass |
d) Get | e) Input | f) random |
g) @ | h) eval | i) list |
j) Convert | k) int | l) { } |
m) Continue | n) ( ) | o) [ ] |
p) Module | q) Dictionary |
4.1 The _e____ command is used to take input from the keyboard
4.2 The __k___ function is used to convert a string value to int.
4.3 The function used to evaluate the value of a string is _h__
4.4 The _n_ function takes the parameter filename and the mode during file processing.
4.5 List structure in python where elements are stored in __o__ parenthesis.
4.6 The __c___ statement lets the program go through the piece of code without performing any action.
4.7 __a___ operator repeats a list for the given number of items.
4.8 __i___ is a set of functions you want to include in your application.
4.9 The structure having keys and values is celled __q___.
4.10 The __b___ function generates a sequence of numbers from 1 to n.
PART TWO (Answer any FOUR Questions) Python Questions
Q5. (5+2+5+3 )
a. Make a flow chart to input any number and find its factorial and print.
b. Explain the role of linker and loader in compilation.
c. Write a flowchart that finds the sum of series: s=1+x/1!+2x/2!+3x/3!+ upto n terms
d. What is a NumPy array. How they are different from lists?
Q6. (5+5+5)
a. Write a recursive function to find the sum of digits of a number.
b. Write a program that takes a sentence as input from the user and returns the frequency of each letter .Use a variable of dictionary type to maintain the count.
c. Program to check whether a string is palindrome or not.
Q7. (5+10)
a. Take an array of 2 rows and three columns, populate it and find the transpose.
b. Explain the following with example:
- LEGB rule
- Seek() function
- Tell()
- String slicing
- List comprehension
Q8. ( 6+6+3)
a. Write a function that takes data to be stored in the file f1 as interactive input till user
responds with nothing as input. Each character taken as input rom the user must be
capitalized and stored in file f1.
b. Write a function that reads the contents of the file myfile.txt and counts the number of alphabets, lowercase letters, uppercase letters, digits and no of words.
c. Take two NumPy arrays having two dimensions. Concatenate the arrays on axis 1.
Q9. (5+5+5)
a. Write a recursive function to count the sum of digits of a number
b. Write a program that takes m as an input parameter and creates a list of m lists such that xth list contains first three multiples of x.
c. Store the monthly earnings of a year of a store splitting up the earnings by quarter into a list of lists. Retrieve the earnings of every month in a loop and display the quarter with maximum earnings.