Computer Sc 24
Computer Sc 24
Section - A
Q1. Find the incorrect identifiers out of the following, which can be used for naming variable or functions is…. 1
a) down b) up c) out d) in
Q2. 2Consider a declaration A=int ("123") type of A is……………. 1
a) int b) float c) bool d) string
Q3. 3Which of the following is not a keyword? 1
a) eval b) INT c) float d) double
Q4. 4Consider the given expression: 1
8 >12 and 13 > 10
Which of the following is the correct value of the expression?
a) True b) False c) None d) NULL
Q5. 5Which of the following can be a variable? 1
a) and b) in c) it d) or
Q6. 6The ……………… statement forms the selection construct in Python. 1
a) If else if b) if c) For d) While
Q7. 7Choose correct option: 1
27=x
Statement 1: Above python code will generate error.
Statement 2: Variable name can come on RHS of assignment operator.
a) Only Statement 1 is true.
b) Only Statement 2 is true.
c) Both Statement 1 and 2 are true, but Statement 2 is not correct reasoning of Statement 1.
d) Both Statement 1 and 2 are true, but Statement 2 is correct reasoning of Statement 1.
Q8. 8What is the answer to this expression, print (22%3, 22//3, int (22/3)) is? 1
a) (1, 7, 7) b) 1, 7, 7 c) (1, 7, 7.3) d) error
Q9. x=3%4+1 1
y=4%3+1
x, y = x, y
print(x, y)
Q10. 9What is the value of the following expression: 8/4//2, 8//(4//2) 1
a) (1.0, 4.0) b) (1.0, 1.0) c) (1, 4) d) (1.0, 4)
Q11. 1Operators with the same precedence are evaluated in which manner? 1
0a) Left to Right b) Right to Left c) Can’t say d) None of the mentioned
Q12. 1Special meaning words of Pythons, fixed for specific functionality are called _______. 1
1a) Keywords b) Identifier c) Functions d) Literals
Q13. 1What type of error occurs when the following code is executed? 1
2Y=int(input(“Please enter a number”))
Please enter a number: Hello
a) Type Error b) Name Error c) Attribute Error d) Value Error
Q14. 1What will be the output of print(ord(‘B’)-ord(‘A)) 1
3a) 0 b) 1 c) -1 d) 2
Q15. 1Select the options that print : AAAAA 1
4a) print("A"+5) b) print("A"*5) c) print("A"**5) d) print(pow("A",5))
Q16. 1What is the output of the functions: round(63.8769,3) 1
5
Q17. 1Which of the following is not a complex number? 1
6a) k = 2 + 3j b) k = complex(2, 3) c) k = 2 + 3l d) k = 2 + 3J
−𝑏+√𝑏2 −4𝑎𝑐
(ii) 𝑥=
2𝑎
Q22. a) If value of x = 10, y = 20 find the value of R = (x != 10 and y == 20) 2
b) Give output:
print(“My” *3 + “life” +’7′)
Q23. 2Write the expression for the following 2
4
Q24. 2Write a program to input a year and check year is leap year or not. 2
5
Q25. 2 a) What is the difference between == and =? Explain with example 2
6 b) What is implicit and Explicit Conversions? Give examples also
SECTION C
Q26. Convert the following: 3
i) (4056)8 = ( )10
(ii) (106.06)10 = ( )2
Criteria Grade
Percentage>85 A
Percentage<85&&Percentage>=75 B
Percentage<75 && Percentage>=50 C
Percentage<30 && Percentage>=50 D
Percentage<30 Reappear
Q28. Write a program in python to calculate and print roots of a quadratic equation: 3
ax2 + bx +c = 0
Note: the program should take values of a, b, c and print if the roots are real, imaginary or equal
SECTION D
Q31. a) Write a menu driven program to calculate sum, subtraction, multiplication and division. 5
b) Write a program to check number is even or odd
Q32. a) Rewrite following code fragment using While Loops 5
min=0
max=num
if num<0:
min=num
max=0
for i in range(min,max+1):
sum+=i
b) Find the output:
a, b = 5 , 3
for i in range(1,11,3):
a+=1
if a>5:
b+=3
print(a , " : ", b)
c) Write a program to print this pattern
*
**
***
****
*****
SECTION E
Q34. a) for y in range (50,100,100): 4
print (“*”, y)
b) Find the output of the following program
a=110
while a>100:
print(a)
a-=2
c) Design a circuit to realise the following:
F(a,b,c)=AB+AC’+B’A’C