0% found this document useful (0 votes)
8 views8 pages

CS Cum Home Test Question

Cs questions class 12

Uploaded by

aadhithyajeevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

CS Cum Home Test Question

Cs questions class 12

Uploaded by

aadhithyajeevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

COMPUTER SCINCE HOME TEST QUESTION ONE MARK TIMING 9:00- 9:30

1. The readlines() method returns

A) str B) a list of lines C) a list of single characters D)a list of integers


2. Which of the following mode will refer to binary data?
A).r B).w C). + d). b
3. Which of the following statement is not correct?

A) We can write content into a text file opened using 'w' mode.
B) We can write content into a text file opened using 'w+' mode.
C) We can write content into a text file opened using 'r' mode.
D) We can write content into a text file opened using 'r+' mode.
4. Which of the following option is the correct Python statement to read and display
the first 10 characters of a text file "Notes.txt”?

A) F = open('Notes.txt') ; print(F.load(10))
B) F = open('Notes.txt') ; print(F.dump(10))
C) F = open('Notes.txt') ; print(F.read(10))
D) F = open('Notes.txt') ; print(F.write (10))
5. Which of the following is not a correct Python statement to open a text file
"Notes.txt" to write content into it?

A) F = open('Notes.txt', 'w')
B) F = open('Notes.txt., 'a')
C) F = open('Notes.txt', 'A')
D) F = open('Notes.txt', 'w+')
6. When is the finally block executed?
A) When there is no exception
B) when there is an exception
C) only if some condition that has been specified is satisfied
D) always
7. What will be the output of the following Python code?
def foo():
try:
return 1
finally:
return 2
k = foo()
print(k)
8. What happens when ‘1’ == 1 is executed?
A) We get a True
B) we get a False
C) an TypeError occurs
D) a ValueError occurs

9. Python provides a keyword _____________ which is always executed after the try and
except blocks
A)finally B)try C)catch D)except
10. Choose correct output for the following sequence of operations (* signifies top)
A)8528* B)8552* C)255* D)52*
11. Stack follow the strategy of______________
A)FIFO B)FILO C)LIFO D)random
12.______________refers to inspecting the value at the stack top without removing it
A)peek B)push D)pop D)random
13. An item sored in a stack is also known as_____________
A)item node B)item pop C)item value D)item none
14. Notation in which the operator is placed before operands is called______________
A)prefix B)infix C)postfix D)sufix
15. a+b an expression in infix to post fix is
A)ab+ B)a+b+ C)+ab D)ba+
16. HTTP stands for:

A) Hyper Text Transfer Protocol


B) Hyper Transmission Text Protocol
C) Having Terminal Transfer Protocol
D) Having Text Transfer Protocol
17. IMAP stands for:

A) Internet Message Access Protocol


B) Internetwork Mapping Access Protocol
C) Internet Mapping Add Protocol
D) Internetwork Message Added Protocol
18. IMAP protocol is usually used at:

A) Outlook program
B) Web based email programs
C) Databases
D) Desktop applications
19. Stack follow the strategy of______________
A)FIFO B)FILO C)LIFO D)random
20.______________refers to inspecting the value at the stack top without removing it
A)peek B)push D)pop D)random
21. An item sored in a stack is also known as_____________
A)item node B)item pop C)item value D)item none
22. Notation in which the operator is placed before operands is called______________
A)prefix B)infix C)postfix D)sufix
23. a+b an expression in infix to post fix is
A)ab+ B)a+b+ C)+ab D)ba+
24. HTTP stands for:

A) Hyper Text Transfer Protocol


E) Hyper Transmission Text Protocol
F) Having Terminal Transfer Protocol
G) Having Text Transfer Protocol
25. IMAP stands for:

E) Internet Message Access Protocol


F) Internetwork Mapping Access Protocol
G) Internet Mapping Add Protocol
H) Internetwork Message Added Protocol
26. IMAP protocol is usually used at:

E) Outlook program
F) Web based email programs
G) Databases
H) Desktop applications
27. The readlines() method returns

A) str B) a list of lines C) a list of single characters D)a list of integers


28. Which of the following mode will refer to binary data?
A).r B).w C). + d). b
29. Which of the following statement is not correct?

A) We can write content into a text file opened using 'w' mode.
B) We can write content into a text file opened using 'w+' mode.
C) We can write content into a text file opened using 'r' mode.
D) We can write content into a text file opened using 'r+' mode.
30. Which of the following option is the correct Python statement to read and display
the first 10 characters of a text file "Notes.txt”?

E) F = open('Notes.txt') ; print(F.load(10))
F) F = open('Notes.txt') ; print(F.dump(10))
G) F = open('Notes.txt') ; print(F.read(10))
H) F = open('Notes.txt') ; print(F.write (10))
31. Which of the following is not a correct Python statement to open a text file
"Notes.txt" to write content into it?

E) F = open('Notes.txt', 'w')
F) F = open('Notes.txt., 'a')
G) F = open('Notes.txt', 'A')
H) F = open('Notes.txt', 'w+')
32. When is the finally block executed?
A) When there is no exception
B) when there is an exception
C) only if some condition that has been specified is satisfied
D) always
15. What will be the output of the following Python code?
def foo():
try:
return 1
finally:
return 2
k = foo()
print(k)
33. What happens when ‘1’ == 1 is executed?
A) We get a True
B) we get a False
C) an TypeError occurs
D) a ValueError occurs

34. Python provides a keyword _____________ which is always executed after the try and
except blocks
A)finally B)try C)catch D)except
35. Choose correct output for the following sequence of operations (* signifies top)
Push(5) push(8) pop push(2) push(5) push(1)
A)8528* B)8552* C)255* D)52*
36. What is the range of frequency for radio waves?
a) 3 KHz to 1 GHz. b) 4 KHz to 1 GHz c) 5 KHz to 1 GHz d) 3 KHz to 2 GHz
37. Rearrange the following terms in increasing order of data transfer rates. Gbps,
Mbps, Tbps, Kbps, bps
a) Mbps, Gbps, Tbps, Kbps, bps b)Tbps, Mbps, Gbps, Kbps, bps

c ) Kbps, Mbps, Tbps, Gbps, bps d)Gbps, Mbps, Tbps, Kbps, bps

38. State true or false Stack can be implemented in using list


39. Hub is a _________________
a) Broadcast device b) unicast device c )multicast device d)none

40. which protocol this image symbolize


a) HTTPS b) HTTP c)SMTP d)none
41. Python provides a keyword ____________ which is always executed after the try and
except blocks
a) finally b)try c)catch d)except
42. Stack follow the strategy of______________
a) FIFO b)FILO c)LIFO d)random

43. What error occurs when you execute the following Python code snippet? Apple =
mango
a) SyntaxError b) NameError c) ValueError d) TypeError
2. Statement A: Data Type defines a set of values along with well-defined operations
starting its input-output behavior
Statement B: Data Structure is a physical implementation that clearly defines a way of
storing, accessing, manipulating data.
a) Only Statement A is True b) Only Statement B is True c) Both are True d)
Both are False
44. An item sored in a stack is also known as_____________
a) item node b)item pop c)item value d)item none
45. Notation in which the operator is placed before operands is called______________
a) prefix b)infix c)postfix d)sufix

2MARK QUESTION 9:30 TO 10:30


1. Write a program to use assert statement to test the division expression in the
program

2.. Consider STACK=[23,45,67,89,51]. Write the STACK content after each operations:
1. STACK.pop( )
2. STACK.append(99)
3. STACK.append(87)
4. STACK.pop( )
3.. Consider the code given below and fill in the blanks.
print("Learning Exceptions...")
try:
num1 = int(input("Enter the first number"))
num2 = int(input("Enter the second number"))
quotient = (num1/num2)
print("Both the numbers entered were correct")
except ...............: # to enter only integers
print("Please enter only numbers")
except ...............: # Denominator should not be zero
print("Number 2 should not be zero")
else:
print("Great .. you are a good programmer")
...............: # to be executed at the end
print("JOB OVER... GO GET SOME REST")

4.. Write the file mode that will be used for opening the following files. Also, write the
Python statements to open the following files:
a text file “example.txt” in both read and write mode.
a binary file “bfile.dat” in write mode.
a text file “try.txt” in append and read mode.
a binary file “btry.dat” in read only mode.

5. What is the use of a raise statement? Write a code to accept two numbers and
display the quotient. Appropriate exception should be raised if the user enters the
second number (denominator) as zero (0).

6.. Write a function push (student) and pop (student) to add a new student name and
remove a student name from a list student, considering them to act as PUSH and POP
operations of stack Data Structure in

7.what will be the output

a=[10,23,56,[78,10]]

b=list(a)

a[3][0]+=17

print (b)

8. What is the significance of MAC address?

9. Suppose the content of a text file “rhymes.txt” is as follows


Jack and jill
Went up the hill
What will be the output of the following python code?
F=open (“rhymes.txt”)
L=f.readlines()
fori in l:
s=i.split ()
Print(len(s),end=”#”)
a.2#4 b3#4 c.2# d.7#

10. Write a program to create a CSV file to store student data [Roll no, Name,
Marks].obtain data from user and write 5 records into the file.

11. Find the Error. Consider the following code, which runs correctly at times but
gives error at other times. Find the error and its reason.

Lst1 = [23, 34, 12, 77, 34, 26, 28, 93, 48, 69, 73, 23, 19, 88]
Lst2 = []
print("List1 originally is: ", Lst1)
ch = int(input("Enter 1/2/3 and \
Predict which operation was performed?"))
if ch == 1:
Lst1.append(100)
Lst2.append(100)
elif ch == 2:
print(Lst1.index(100))
print(Lst2.index(100))
elif ch == 3:
print(Lst1.pop())
print(Lst2.pop())
5MARK 10:30TO 11:30
1."Learn Together" is an educational NGO. It is setting up its new campus at Jabalpur
for its web based activities. The campus has 4 compounds as shown in the adjacent
diagram.

Center to center distances between various Compounds as per architectural drawings


(in metres) is as follows :

Main Compound to Resource Compound 110 m


Main Compound to Training Compound 115 m

Main Compound to Finance Compound 35 m

Resource Compound to Training Compound 25 m

Resource Compound to Finance Compound 135 m

Training Compound to Finance Compound 100 m

Expected Number of Computers in each Compound is as follows :

Main Compound 5

Resource Compound 15

Training Compound 150

Accounts Compound 20

(a) Suggest a cable layout of connections between the compounds.

(b) Suggest the placement of the following devices with justification :

(i) Repeater

(ii) Hub/Switch

2..If the file 'poemBTH.txt' contains the following poem (by ParamhansYoganand) :
God made the Earth;
Man made confining countries
And their fancy-frozen boundaries.
But with unfound boundLess Love
I behold the borderLand of my India
Expanding into the World.
HaiL, mother of religions, Lotus, scenic beauty, and sages!
a)my_file=open('poemBTH.txt', 'r')
my_file.read()
b)my_file=open('poemBTH.txt', 'r')
my_file.read(100)
c) my_file=open('poemBTH.txt', 'r')
my_file.readlines()

3. Define pickling in Python. Explain serialization and deserialization of Python object.


4. Discuss various network protocols (or)
Discuss various network devices

You might also like