Computer ScienceA2 MID TERM 2022 23 MS
Computer ScienceA2 MID TERM 2022 23 MS
General Instructions:
Ans : b) 10
Ans : a) string
Q3. Consider the declaration L = '3.14+20j'. What will be the data type of L? (1)
a) list
b) tuple
c) dictionary
d) String
Ans : d) String
Q4. Which of the following symbols is used in python for single line comment? (1)
a) / b) /* c) // d) #
Ans. #
1
Ans : d) All of the above
Ans : a) Two
Ans : c) & d)
a) 432
b) 342
c) 164
d) 102
Ans : b) 1st_string
Q11. Differentiate between proprietary software and freeware software. Name two software for
each type. (2)
Ans.
Proprietary Software Freeware Software
2
Source code is not available Source code is available
Q12. How does the computer understand a program written in high level language? (2)
Ans. Humans are able to write programs in high-level language while computers can
understand only machine language. so with the help of language translators (Compiler or
Interpreter) programs written in HLL can be converted into machine language which is
understood by computer.
Q13 Name the software required to make a computer functional. Write down its two primary
services. (2)
Ans. The software required to make a computer functional is Operating System (OS). It’s two
primary services are :
Memory management : It manages Primary or main memory of a computer system.
Device Management : It interacts with the device driver and the related software for a
particular device.
Q14. What is the need for RAM? How does it differ from ROM? (2)
Ans. RAM is used to store data temporarily while the computer is working. Whenever the
computer is started or a software application is launched, the required program and data
are loaded into RAM for processing.
RAM ROM
It stands for Random Access Memory It stands for Read Only Memory
It is volatile in nature It is non volatile
It stores data temporarily It stores instruction permanently
Q15 a) Draw the logic circuit for this Boolean expressions: (2x2=4)
ii) (X+Y).(X+Z)
3
b) In the Boolean Algebra, verify using truth table that X + XY = X (2)
c) Derive a Boolean expression for the output F for the logic circuit given shown below :
(2x2=4)
i)
Ans. (A’B’+CD)’
ii)
Ans. (A’.(A+B))
Q17. What are string literals? How many types of string literals are there? (2)
4
Ans. A string literal is a sequence of zero or more characters enclosed within single
quotation marks. The following are examples of string literals: 'Hello, world!' 'He
said, "Take it or leave it."' In python we have two types of string literals namely single
line strings and multiline strings.
Q18. What do you mean by data types? What are Python’s built-in core data types? (2)
Ans. Python Data Types are mainly of 3 types: Boolean, integer, and string. These may also be
called the core data types in Python.
Q19. What is the difference between implicit and explicit conversion? (2)
Ans. Implicit Type Conversion is automatically performed by the Python interpreter. Python
avoids the loss of data in Implicit Type Conversion. Explicit Type Conversion is also called
Type Casting, the data types of objects are converted using predefined functions by the
user.
Q20. What is the difference between interactive mode and script mode in Python? (2)
Ans. Script Mode, is used when the user is working with more than one single code or a block of
code. Interactive mode is used when an user wants to run one single line or one block of
code.
Ans.a) False
b) 22
Q22. Write a program to enter a number and print whether the number is positive, negative or
zero. (3)
Q25. A school conducts 3 weekly tests of 30 marks each and a term exam of 100 marks. To
calculate the aggregate percentage of marks obtained by a student, calculations are done as
follows:
Aggregate Percentage = (weekly test total)/3+70% of term exam.
Write a Python script to calculate and display the aggregate percentage of a student after
taking the marks of the student in the three weekly tests and the term exam. (3)
Q26. Identify errors in the following code and rewrite the code by underlining the corrections.
(3x2=6)
a) A=B=12/5
if A!=b
print"Not equal"
else print"Equal"
Ans. A=B=12/5
if A!=B:
print("Not equal")
6
else:
print("Equal")
c) x = input(“Enter value”)
for k in range[0,20]
Print(x+k)
a) year=2000 (1)
if year%100!=0 and year%4==0 or year%400==0:
print("Lp")
else:
print("Not Lp")
Ans. Lp
Ans. 2#3@4#5#6#7@7
c) x=5 (2)
for k in range(0,10) :
7
if x==k:
print(x+k)
else:
print(x-k)
Ans : 5
4
3
2
1
10
-1
-2
-3
-4
e) x=6 (2)
for i in range(x):
if x==5:
break
print("H")
print(x)
Ans : H
H
H
H
H
H
6
8