[Total Marks: 75]
[Total Time: 2 ½ ]
N.B. : (1) All the questions are compulsory.
(2) Figures to the right indicate full marks.
(3) Illustrations, in-depth answers, and diagrams will be appreciated.
(4) Mixing of sub-questions is not allowed.
(5) Assume suitable data wherever required.
____________________________________________________________________________________________________________________________
Q. 1 Attempt All (Each of 5 Marks) (15M)
A) Multiple choice questions :
1) and, or, not are operators.
(i) Arithmetic (ii) Logical
(iii) Relational (iv) Assignment
2) What is the output of len([1, 2, 3]) ?
(i) 1 (ii) 2
(iii) 3 (iv) 4
3) A variable defined inside the function is called
variable.
(i) Local (ii) Global
(iii) Block (iv) Identifier
4) Which of the following function converts a string to all uppercase?
(i) upper () (ii) isdecimal ()
(iii) Swapcase () (iv) title ()
5) What is the output of the following?
k = [print (1) for i in my_string if i in “aeiou”]
(i) prints all the vowels in my_string
(ii) prints all the consonants in my_string
(iii) prints all characters of my_string that aren’t vowels
(iv) None of these
B) Fill in the blanks.
1) &&, | |, ^ are ___________________operators.
2) arithmetic operator (%) is used for ______________.
3) ____________________ Statement terminates the loop statement and transfers execution to the statement immediately following the loop.
4) To use sqrt () function we need to import ___________________ module.
5) An instance of a class is called as ______________________.
C) Short answers:
1) What is the use of del statement?
2) Define Assignment statement.
3) Write syntax to create a List.
4) List any four methods of List.
5) Explain the use of “Pass” statement.
Q. 2. Answer any three from the following : (Each of 5Marks) (15M)
(a) Write a short note on IDLE.
(b) Discuss Operator Precedence along with an example.
(c) What is variable? What are the rules and conventions for declaring a variable?
(d) What is the difference between simple and expression statements?
(e) Explain “string” data types in regards with following:
(i) Declaration and initialization of variable of “string” data type
(ii) Displaying second character of a string.
(iii) Display all characters of a string.
(iv) Display all characters starting from second position in a string.
(v) Repeat string twice and display it.
(f) Write a program to calculate area of rectangle and circle. Take input from
the user.
Q.3. Answer any three from the following : (Each of 5Marks) (15M)
(a) How do we implement if-elif condition? explain with example.
(b) Explain continue statement.
(c) Discuss the difference between local and global variables.
(d) What is actual and formal parameter in user defined functions?
(e) Explain Tuples. How do we create Tuples? Explain with example.
(f) Write a program to print the numbers divisible by 3 till n. Take n as input
from user. (Create user-defined function).
Q. 4. Answer any three from the following : (Each of 5Marks) (15M)
(a) What is the difference between user-defined function and anonymous
function?
(b) Write a short note on List Comprehension.
(c) Explain the following terms of Object-Oriented Programming :
(i) Class (ii) Methods
(d) Discuss the concept “Dictionary”.
(e) Define Built-in functions. Explain any 4 built-in functions along with an
example.
(f) Write a program to create an anonymous function to calculate Cube of a
number.
Q. 5. Answer any three from the following : (Each of 5Marks) (15M)
(a) Define user-defined function. Write the syntax to define user-defined
function. Give example for the same.
(b) Illustrate the use of range () in python along with an example.
(c) Write a short note on assert statement.
(d) What is the difference between interactive and script modes of IDLE?
(e) Explain for loop with example.
____________________________________________________________________________________________________________________________