Abhyas Test 1 - Descriptive - QP
Abhyas Test 1 - Descriptive - QP
Q.No.
Section – A: Answer all the questions [ 09 X 01 = 09 Marks] Allotte
:
d
How a>b>c will be interpreted by Python? 1
1
a) a>b or a>c b) a>b not a>c c) a>b and a>c d) a>b && a>c
Mr Subodh is working with a dictionary in python for his project. He 1
wants to display the key, and value pair but confuse by these
2 statements, choose the correct statement for him:
a) dict.values() b) disct.keys() c) dict.keysvalues() d) dict.items()
Following set of commands are executed in shell, what will be the 1
output?
3 >>>str="hello"
>>>str[:2]
a) he b) lo c) olleh d) hello
What is the output of the 1
following?
x = ['ab', 'cd']
for i in x:
4
i.upper()
print(x)
a) [‘ab’, ‘cd’] b) [‘AB’, ‘CD’] c) [None, None] d) none of the
mentioned
Consider the given expression: 1
not True and False or True
5 Which of the following will be correct output if the given expression is
evaluated?
a) True b) False c) NONE d) NULL
What is the output of below 1
program?
def cube(x):
6 return x * x * x
cube(3)
print x
a) 9 b) 3 c) 81 d) 27
7 Archi is confused between arguments and parameters. Select the fact 1
about argument and parameter and solve her doubt.
a) arguments are those values being passed and parameters are those
values received
b) parameters are those values being passed and arguments are those
values received
d) arguments can have same name and parameters can have value
type
Rashmin is learning the python functions He read the topic types of 1
python functions. He read those functions already available in the
python library is called ___________. Fill appropriate word in this blank:
8
a) UDF (User Defined Function) b) Built-in Functions c) Modules d)
Reusable Function
Q9 is ASSERTION AND REASONING based questions. Mark the
correct choice as.
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False (d) A is false but R is True
Assertion (A):- Process of inserting an element in stack is called Push. 1
9 Reasoning (R):- In a stack, if a user tries to remove an element from empty stack it is
called overflow.
Q.No.
Section – B : Answer all the questions [ 03 X 02 = 06 Marks]
:
Predict the output for the following code: 2
s=”welcome2cs”
n=len(s)
m= “ ”
for i in range(0, n):
if (s[i] >=’a’ and s[i]<=’m’):
m=m+s[i].upper()
10 elif (s[i] >=’n’ and s[i]<=’z’):
m=m+s[i].lower()
else:
m=m+’&’
print(m)
=
2
Predict the output of the Python code given
below:
x=1
def fun1( ):
x=3
x=x+1
print(x)
12 def fun2( ):
global x
x=x+2
print(x)
fun1( )
fun2( )
=
Q.No.
Section – C : Answer all the questions [ 02 X 03 = 06 Marks]
:
13 Write a function in PUSH(Lst) Python, where Lst is a set of numbers. 3
From this list, push all numbers divisible by 5 into a stack
implemented by using a list. Display the stack if it has atleast one
element, otherwise display appropriate error message (Underflow!)
=
Predict the output: 3
values = [10, 20, 30, 40, 50]
for val in values:
14 for I in range(1, val%9):
print(I, “*”, end=””)
print()
=
Q.No.
Section – D : Answer all the questions [ 02 X 05 = 10 Marks]
:
a) Predict the output: 3+2
def changedata(str1):
length=len(str1)
temp=""
for i in range(0, length):
if str1[i].islower():
temp=temp+str1[i].upper()
elif str1[i].isupper():
temp=temp+str1[i].lower()
elif str1[i].isdigit():
temp=temp+str(int(str1[i])+1)
else:
temp=temp+'^'
15
print(temp)
changedata("Kvs_nishant@2023")
=
Q.No.
Section – E : Answer all the questions [ 01 X 04 = 04 Marks]
:
17 a) Write definition of a method COUNTNOW(PLACES) to find and display 2+2
those place names in which there are more than 5 characters.
For example:
If the list PLACES contains ["DELHI", "LONDON", "PARIS", "NEW YORK",
"DUBAI"]
The following output should be displayed:
LONDON
NEW YORK
=