Professional Documents
Culture Documents
9b9c1
9b9c1
9b9c1
1
a. I=J=K=50 b. I,J,K=50,60,70 c. I J K =50 60 70 d. I_J_K=70
11. The reserved words used by Python interpreter to recognize the structure of a program are
termed as
a. Keywords b. Identifiers c. Tokens d. Literals
12. Operators that act upon two operands are referred as …..
a. Unary operator b. Binary Operator c. Assignment Operator d. None
13. The Error that occurs during the execution of the program is known as ….
a. syntax error b. Semantic error c. Run time error d. none
16. Assertion : Data type in Python are bound to a variable at compile time
Reasoning : Python supports dynamic typing
a. Both Assertion and Reasoning are correct
b. Assertion is correct but explanation provided is incorrect
c. Assertion is incorrect but the reasoning is valid in Python
d. Both Assertion and Reasoning are incorrect
18. Assertion: Data type in python are bound to the variable at compile time
Reason: Python supports dynamic typing
a) Both Assertion and reasoning are correct
b) Assertion is correct but reasoning is not the reason for it
c) Both Assertion and Reasoning are incorrect
d) Assertion is not true but Reasoning is true in Python
2
1) Write a statement to assign the value of (a*a) + (b*b) to a variable.
2) I want to divide 1 by 3 and get a result like: 0.333333333333. What is the exact command to
do this?
3) What will be the output of 15.0/3?
4) What does the modulus operator do?
5) Mention the use of following escape sequence
a. \n
b. \t
6) If a=70 and b=10 then determine the result of the following:
a. a/b
b. a% b
7) What is the purpose of using comments in a program?
8) What is an assignment statement?
9) What will be the output of the following:
a. i=30*15/3
b. i=30/15*3
10) What is the result of the following expression :
p>=q && (p+q) > p
a. P=3,q=0
b. P=5,q=5
11) Predict the output of :
a. print(type("17"))
b. print(type("3.2"))
12) How can you determine the type of a variable in python?
13) Is the following a legal variable name in Python : A_good_grade_is_A+
16) What will be the value of variables a and b in the following code:
a=5
b=a
print(a,b)
a=3
print(a,b)
4
day = 19
print(day)
11) What will be the output of the following if my_age=29 and my_height=104
a. print “I am %s inches tall” % my_heigth
b. print “ My age is %d” % my_age
c. print “There are %d days in a week” %7
12) Write a program to find roots of a quadratic equation.
13) Write a program to find whether a number entered by the user is positive or negative.
14) Rohit gets a basic pay of Rs.8000. His dearness Allowance is 40% of basic salary and house
rent allowance is 20% of the basic salary. Calculate his gross salary.
15) Write a program to calculate simple interest.
16) Many people keep time using a 24 hour clock (11 is 11am and 23 is 11pm, 0 is midnight). If
it is currently 13 and you set your alarm to go off in 50 hours, it will be 15 (3pm). Write a
5
Python program to the above problem. Ask the user for the time now (in hours), and then ask
for the number of hours to wait for the alarm. Your program should output what the time will
be on the clock when the alarm goes off.
17) Write a program to calculate area of a triangle using hero’s formula.
18) Write a program to calculate volume and surface area of a cuboid whose length, breadth and
height are given.
19) Name the days of the week from 0-6 where day 0 is Sunday and day 6 is Saturday. If you go
on a holiday leaving on day number 3 (a Wednesday) and you return home after 10 nights.
Write a program which asks for the starting day number, and the length of your stay, and it
will tell you the number of day of the week you will return on.
20) Use IDLE to do the following:
i. Calculate total and average of marks scored in five subjects
ii. Find whether a number is even or odd.
iii. Find whether a number is divisible by 3 .
1. (a) What are escape sequences? Name any one escape sequence.
(b) How do you print escape sequences as printable characters?
(c ) Based on your concepts in a) and b) what will be the output of the below statement?
print('c:\naveen\temp\a jpg'.'fi lc is opened',sep='\n')
2. Harshit has written a program to calculate in how many days a work will be completed by
three persons A, B and C together. A, B, C take x days, y days and z days respectively to
do the job alone. The formula to calculate the number of days if they work together is
xyz / (xy +yz +xz) days where x, y, and z are given as input to the program.
1) The following statement produces no output when not run in the shell.
3.14 * 6 * 6
Modify it to produce output.
3) The following statement produced an output of 13 and not 20. Explain the reason.
x=7+3*2
6
5) Enter the following code on the prompt:
>>> 1 == 1
>>> "1" == "1"
>>> 1 == "1"
Why does the third line returns false, while the first 2 lines are true?