KV Computer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 64

केन्द्रीय विद्यालय संगठन/KENDRIYA VIDYALAYA SANGATHAN

हैदराबाद संभाग /HYDERABAD REGION

STUDENT SUPPORT MATERIAL


ON
MCQs AND COMPETENCY BASED QUESTIONS 2023-24

CLASS XII SUBJECT COMPUTER SCIENCE

CHIEF PATRON
Dr D MANJUNATH, DEPUTY COMMISSIONER

PATRON
Mr T PRABHUDAS, ASSISTANT COMMISSIONER

CO ORDINATOR
SRI HONEY MEHTA, PRINCIPAL, KV GUNTUR

COMPILED BY:
Mrs M CELINA SOWJANYA, PGT CS, KV GUNTUR

PREPARED BY PGT COMPUTER SCIENCE:


1. Mr R VIJAY KUMAR, KV MACHILIPATNAM
2. Mr B SRINIVASA RAO, KV MALKAPURAM
3. Ms NEHA YADAV, KV KURNOOL
4. Mrs G SOWJANYA, KV TENALI
5. Ms K PRANEETHA, KV NELLORE
6. Mr J KIRAN KUMAR, KV NAD, VISAKHAPATNAM
1
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
MULTIPLE CHOICE QUESTIONS
(MCQs)

2
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
UNIT-1 COMPUTATIONAL THINKING AND PROGRAMMING – 2

PYTHON REVISION TOUR


1. Which of the following is NOT a valid variable name in Python?
a) my_variable b) 123variable c) variable123 d) _variable

2. Which of the following is a recommended practice when naming variables in Python?


a) Using single letters or abbreviations for variable names to save space
b) Starting variable names with an underscore (_) to indicate privacy
c) Using descriptive names that convey the purpose or meaning of the variable
d) Including special characters, such as @ or $, in variable names for uniqueness
3. What will be the output of the following code?
numbers = [1, 2, 3, 4, 5]
total = 0
for num in numbers:
total += num
print(total)

a) 15 b) 10 c) 5 d) 0
4. What will be the output of the following code?
numbers = [1, 2, 3, 4, 5]
for i in range(len(numbers)):
numbers[i] *= 2
print(numbers)

a) [1, 2, 3, 4, 5] b) [2, 4, 6, 8, 10] c) [1, 4, 9, 16, 25] d) [2, 3, 4, 5, 6]


5. What will be the output of the following code?
numbers = [1, 2, 3, 4, 5]
total = 0
for num in numbers:
if num % 2 == 0:
continue
total += num
print(total)

a) 9 b) 6 c) 5 d) 0
6. What will be the output of the following code?
word = "Python"
reversed_word = ""
for char in word:
reversed_word = char + reversed_word
print(reversed_word)

a) Python b) nohtyP c) Py d) ythoP


7. What will be the output of the following code?
number = 10
while number > 0:
print(number)
number //= 2
a) 10 5 2 1 b) 10 8 6 4 2 c) 10 5 2 d) 10 9 8 7 6 5 4 3 2 1
8. Which of the following options correctly checks if two lists are equal in Python?
3
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
A) list1 == list2 B) list1 is list2 C) list1.equals(list2) D) list1.compare(list2)
9. Which of the following methods returns the index of the first occurrence of a specified value in a
list?
A) index() B) find() C) search() D) locate()

10. Which of the following options correctly merges two lists in Python?

A) list1 + list2 B) list1.extend(list2) C) list1.append(list2) D) list1.merge(list2)

11. What is the output of the following code?


my_list = [1, 2, 3, 4, 5]
new_list = my_list[::-1]
my_list[0] = 10
print(new_list)
A) [1, 2, 3, 4, 5] B) [5, 4, 3, 2, 1] C) [5, 4, 3] D) [10, 2, 3, 4, 5]

12. What is the output of the following code?


my_list = [1, 2, 3, 4, 5]
new_list = my_list.copy()
my_list.append(6)
print(new_list)
A) [1, 2, 3, 4, 5] B) [1, 2, 3, 4, 5, 6] C) [1, 2, 3, 4, 5, [6]] D) [1, 2, 3, 4, 5, (6)]

13. Which of the following options correctly splits a string into a list of words in Python?

A) str.split() B) str.split(',') C) str.split(' ') D) All of the above

14. What is the output of the following code?


str1 = "Hello World"
str2 = str1.replace("Hello", "Goodbye")
print(str1)
A) "Hello World" B) "Goodbye World"
C) "Hello Goodbye" D) Error: Strings are immutable and cannot be modified.

15. What will be the output of the following code?


str1 = "Hello World"
result = str1.find("W")
print(result)

A) 6 B) 7 C) -1 D) Error: Strings do not have a `find()` method.


16. What will be the output of the following code?
my_dict = {"apple": 3, "banana": 2, "cherry": 5}
sorted_dict = sorted(my_dict)
print(sorted_dict)
A) ["apple", "banana", "cherry"] B) ["cherry", "banana", "apple"]
C) [("apple", 3), ("banana", 2), ("cherry", 5)] D) Error: Dictionaries cannot be sorted.

17. What is the output of the following code?


my_dict = {"apple": 3, "banana": 2, "cherry": 5}
keys = my_dict.keys()
print(keys)
A) ["apple", "banana", "cherry"] B) ["apple"]
C) ["banana"] D) dict_keys(["apple", "banana", "cherry"])
18. What does it mean for a Python object to be "immutable"?
4
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
a) It cannot be modified or changed after it is created.
b) It can only be accessed by a single thread at a time.
c) It can be converted to a different data type using type casting.
d) It can be modified but only within a limited range of values.

19. What does the following code snippet do?


my_string = "Hello, World!"
new_string = my_string.replace("Hello", "Hi")
print(new_string)
a) Replaces all occurrences of "Hello" with "Hi" in the string.
b) Replaces the first occurrence of "Hello" with "Hi" in the string.
c) Replaces all occurrences of "Hi" with "Hello" in the string.
d) Replaces the first occurrence of "Hi" with "Hello" in the string.

20. What is the data type of the result after executing the following code?
x = "Hello"
y=3
result = x * y
a) str b) int c) bool d) None

FUNCTIONS,MODULES AND LIBRARIES IN PYTHON


21. Which of the following items are present in the function header?

A) function name B) parameter list C) return value D) Both A and B


22. If return statement is not used inside the function, the function will return:

A) None B) 0 C) Null D) Arbitary value


23. What is a recursive function?

A. A function that calls other function. B. A function which calls itself.


C. Both A and B D. None of the above

24. Which of the following function headers is correct?

A) def fun(a = 2, b = 3, c) B) def fun(a = 2, b, c = 3)


C) def fun(a, b = 2, c = 3) D) def fun(a, b, c = 3, d)

25. What is a variable defined outside a function referred to as?

A) local variable B) global variable C) static Variable D) automatic variable

26. Which one of the following is the correct way of calling a function?

A) function_name() B) call function_name()


C) ret function_name() D) function function_name()
27. Identify the incorrect statement?

A) The variables used inside function are called local variables.


B) The local variables of a particular function can be used inside other functions, but these cannot
be used in global space
5
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
C) The variables used outside function are called global variables
D) In order to change the value of global variable inside function, keyword global is used.
28. When you create your own functions, they are called?

A) built-in functions
B) user-defined functions
C) control functions
D) None of the above

29. What will be the output of the following code?


def my_func():
x = 10
while x > 0:
print(x)
x -= 2

my_func()

a) 10 8 6 4 2 b) 10 9 8 7 6 5 4 3 2 1 c) 10 7 4 1 d) 10 5

30. What will be the output of the following code?


def print_pattern(n):
for i in range(n):
for j in range(i + 1):
print(j + 1, end=" ")
print()

print_pattern(4)

31. What will be the output of the following code?


def countdown(n):
while n >= 0:
if n == 3:
break
print(n)
n -= 1
else:
print("Blastoff!")

countdown(5)

a) 5 4 b) 5 4 3 c) 5 4 3 2 1 Blastoff! d) 5 4 3 Blastoff!
32. What will be the output of the following code?
def compute_average(numbers):
total = 0
count = 0
for num in numbers:
total += num
count += 1
6
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
return total / count

marks = [80, 90, 75, 95, 85]


average = compute_average(marks)
print("Average:", average)
a) Average: 85 b) Average: 85.5 c) Average: 85.0 d) Average: 80, 90, 75, 95, 85
33. What will be the output of the following code?
def print_table(n):
for i in range(1, n+1):
for j in range(1, n+1):
print(i * j, end=" ")
print()

print_table(3)

34. What will be the output of the following code?


def func(x, y=2, z=3):
return x + y + z

result = func(1, z=4)


print(result)
a) 6 b) 8 c) 10 d) 11

35. What will be the output of the following code?


def outer_func():
x=2
def inner_func():
nonlocal x
x += 1
print(x)
inner_func()
outer_func()

a) 2 b) 3 c) 4 d) Error: nonlocal declaration not allowed at module level

36. What will be the output of the following code?


def fibonacci(n):
if n <= 0:
return []
elif n == 1:
return [0]
elif n == 2:
return [0, 1]
else:
fib_sequence = [0, 1]
while len(fib_sequence) < n:
next_number = fib_sequence[-1] + fib_sequence[-2]
fib_sequence.append(next_number)
return fib_sequence

7
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
result = fibonacci(8)
print(result)
a) [0, 1, 1, 2, 3, 5, 8] b) [0, 1, 1, 2, 3, 5, 8, 13] c) [0, 1, 2, 3, 5, 8] d) [0, 1, 2, 3, 5, 8, 13]

37. What is the output of the following code snippet?


def foo(x=0):
x += 1
return x
result = foo(5) + foo(3)
print(result)
a) 10 b) 9 c) 8 d) 7
38. 4. What does the following code snippet do?
def factorial(n):
if n == 0:
return 1
return n * factorial(n-1)

result = factorial(5)
print(result)

a) Computes the sum of numbers from 1 to 5. b) Computes the product of numbers from 1 to 5.
c) Calculates the factorial of 5. d) Raises 5 to the power of 5.

39. What will be the output of the following code?


a=5
def foo():
global a
a += 1

foo()
print(a)
a) 5 b) 6 c) 10 d) NameError: name 'a' is not defined
40. What is the output of the following code snippet?
def multiply(a, b):
return a * b

def calculate(x, y, operation=multiply):


return operation(x, y)

result = calculate(4, 5)
print(result)
a) 9 b) 20 c) 45 d) 25

EXCEPTION HANDLING
41. What is an exception in Python?
a) An error b) A warning c) A function d) A class

42. Which keyword is used to raise an exception explicitly in Python?


a) catch b) throw c) raise d) try
43. What is the purpose of the 'finally' block in a try-except statement?
a) To handle exceptions b) To specify alternative code
c) To execute cleanup code d) To suppress errors

8
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
44. Which of the following is not an exception handling clause in Python?
a) try b) except c) else d) throw
45. What will be the output of the following code?
try:
print(10 / 0)
except ZeroDivisionError:
print("Error: Division by zero")

a) Error: Division by zero b) Error: Index out of range c) 10 d) None of the above
46. In a try-except block, if an exception occurs but it is not handled by any except clause, what
happens?
a) The program terminates b) The exception is ignored
c) The program continues to execute normally d) None of the above
47. Which keyword is used to define a block of code that will be executed if no exceptions are raised?
a) try b) catch c) else d) finally
48. What is the purpose of the 'except' clause in a try-except statement?
a) To define alternative code b) To specify the type of exception to handle
c) To handle multiple exceptions d) To execute cleanup code
49. Which of the following statements is true about nested try-except blocks?
a) Only one try block can be nested inside another try block
b) Only one except block can be nested inside another except block
c) A try block can be nested inside another try block, and an except block can be nested inside
another except block
d) Nesting try-except blocks is not allowed in Python
50. 10. Which exception is raised when an incorrect type of argument is passed to a function in
Python?
a) ValueError b) TypeError c) AttributeError d) NameError
51. What will be the output of the following code?
try:
print(10 / 0)
except ZeroDivisionError as e:
print("Error:", str(e))
finally:
print("Finally block")

a) Error: Division by zero


Finally block
b) Error: Index out of range
Finally block
c) Error: None
Finally block
d) The code will raise an exception and terminate.
52. What will be the output of the following code?
try:
raise ValueError("Custom Error")
except Exception as e:
print("Error:", str(e))
finally:
print("Finally block")

a) Error: Custom Error


Finally block
b) Error: ValueError
9
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
Finally block
c) Error: Exception
Finally block
d) The code will raise an exception and terminate.
53. What will be the output of the following code?
def divide(x, y):
try:
result = x / y
except ZeroDivisionError:
print("Error: Division by zero")
else:
print("Result:", result)
divide(10, 2)
a) Error: Division by zero b) Result: 5
c) The code will raise an exception and terminate. d) None of the above.
54. What will be the output of the following code?
try:
print("Hello" + 123)
except TypeError:
print("Error: Type mismatch")
else:
print("No error")
a) Hello123
No error
b) Error: Type mismatch
No error
c) Error: Type mismatch d) The code will raise an exception and terminate.
55. What will be the output of the following code?
try:
f = open("nonexistent_file.txt", "r")
except FileNotFoundError:
print("Error: File not found")
finally:
print("Finally block")
a) Error: File not found b) Finally block
Finally block
c) The code will raise an exception and terminate. d) None of the above.
56. What will be the output of the following code?
try:
print("Start")
raise Exception("Custom Error")
except Exception as e:
print("Error:", str(e))
finally:
print("Finally block")
a) Start
Error: Custom Error
Finally block
b) Error: Custom Error
Start
Finally block
c) Error: Custom Error
Finally block
10
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
Start
d) The code will raise an exception and terminate.
57. What will be the output of the following code?
def divide(x, y):
try:
result = x / y
except ZeroDivisionError:
print("Error: Division by zero")
finally:
print("Finally block")

divide(10, 0)
a) Error: Division by zero b) Finally block
Finally block
c) The code will raise an exception and terminate. d) None of the above.

58. What will be the output of the following code?


try:
print(10 / "abc")
except TypeError:
print("Error: Type mismatch")
else:
print("No error")
finally:
print("Finally block")
a) Error: Type mismatch
Finally block
b) No error
Finally block
c) Error: Type mismatch
No error
d) The code will raise an exception and terminate.
59. What will be the output of the following code?
try:
x = 10
y=0
result = x / y
except ZeroDivisionError:
print("Error: Division by zero")
except Exception:
print("Error: Some other exception")
else:
print("Result:", result)
finally:
print("Finally block")
a) Error: Division by zero
Finally block
b) Error: Some other exception
Finally block
c) Result: Infinity
Finally block
d) The code will raise an exception and terminate.

11
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
60. What will be the output of the following code?
try:
raise NameError("Custom Error")
except ValueError:
print("Error: ValueError")
except NameError:
print("Error: NameError")
else:
print("No error")
a) Error: ValueError b) Error: NameError
c) No error d) The code will raise an exception and terminate.

DATA FILE HANDLING - TEXT FILES


61. Which of the following functions is used to open a file in Python for reading?

a) read() b) open() c) write() d) close()

62. What is the correct syntax to open a file named "data.txt" in write mode in Python?

a) file = open("data.txt", "r") b) file = open("data.txt", "w")


c) file = open("data.txt", "a") d) file = open("data.txt", "x")

63. Which method is used to read a single line from a file object in Python?

a) readlines() b) readline() c) read() d) write()

64. Which of the following modes in file handling allows both reading and writing to a file in Python?

a) "r" b) "w" c) "a" d) "r+"

65. What is the purpose of the seek() method in file handling?

a) To close the file after reading or writing


b) To move the file pointer to a specific position in the file
c) To check if the file is readable or writable
d) To delete the contents of the file

66. Which method is used to write a string to a file in Python?

a) write() b) read() c) append() d) delete()

67. What is the correct way to close a file object after reading or writing in Python?

a) file.close() b) close(file) c) file.exit() d) exit(file)

68. Which method is used to check the current position of the file pointer in Python?

a) current() b) position() c) tell() d) pointer()

69. How can you read the contents of a file line by line in Python?

a) Use the readlines() method b) Use the read() method


c) Use the write() method d) Use the close() method
12
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
70. Which method is used to read the entire contents of a file as a single string?
a) read() b) readline() c) readlines() d) write()
71. How can you ensure that a file is automatically closed after its operations are completed?

a) Using the close() method b) Using the flush() method


c) Using the with statement d) None of the above

72. How do you check if a file exists before opening it in Python?

a) Use the exists() function from the os module


b) Use the open() function with the try-except block
c) Use the isfile() function from the os.path module
d) All of the above
73. Which mode should be used when opening a file for reading only?

a) 'r' b) 'w' c) 'a' d) 'x'


74. Which of the following statements is true regarding file objects in Python?

a) File objects can be directly printed to display their contents.


b) File objects can only be used for reading files, not writing.
c) File objects have a 'write' method but not a 'read' method.
d) File objects must be explicitly closed using the 'close' method.

75. Consider the following code snippet:


file = open("data.txt", "r")
content = file.read()
file.close()
print(content)
What does this code do?
A) Opens the "data.txt" file in read mode, reads its contents, closes the file, and prints the content.
B) Opens the "data.txt" file in write mode, reads its contents, closes the file, and prints the content.
C) Opens the "data.txt" file in read mode, writes new content, closes the file, and prints the content.
D) Opens the "data.txt" file in read mode, appends new content, closes the file, and prints the
content.

76. Consider the following code snippet:


file = open("data.txt", "w")
file.write("Hello, World!")
file.close()
What does this code do?
A) Opens the "data.txt" file in read mode, reads its contents, and writes "Hello, World!" to the file.
B) Opens the "data.txt" file in write mode, writes "Hello, World!" to the file, and closes the file.
C) Opens the "data.txt" file in write mode, reads its contents, and writes "Hello, World!" to the file.
D) Opens the "data.txt" file in append mode, appends "Hello, World!" to the file, and closes the
file.
77. Consider the following code snippet:
file = open("data.txt", "a")
file.write("Hello, World!")
file.close()

What does this code do?

13
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
A) Opens the "data.txt" file in read mode, reads its contents, and appends "Hello, World!" to the
file.
B) Opens the "data.txt" file in write mode, writes "Hello, World!" to the file, and closes the file.
C) Opens the "data.txt" file in append mode, appends "Hello, World!" to the file, and closes the file.
D) Opens the "data.txt" file in append mode, reads its contents, and appends "Hello, World!" to the
file.

78. Consider the following code snippet:


file = open("data.txt", "r")
lines = file.readlines()
file.close()
print(len(lines))

What does this code do?

A) Opens the "data.txt" file in write mode, reads the number of lines in the file, closes the file,
and prints the count.
B) Opens the "data.txt" file in read mode, reads the number of lines in the file, closes the file, and
prints the count.
C) Opens the "data.txt" file in append mode, reads the number of lines in the file, closes the file,
and prints the count.
D) Opens the "data.txt" file in read mode, writes the number of lines in the file, closes the file,
and prints the count.
79. Consider the following code snippet:
file = open("data.txt", "w")
file.writelines(["Hello\n", "World\n"])
file.close()

What does this code do?


A) Opens the "data.txt" file in write mode, writes "Hello" and "World" on separate lines, and
closes the file.
B) Opens the "data.txt" file in read mode, reads "Hello" and "World" from the file, and closes the
file.
C) Opens the "data.txt" file in append mode, appends "Hello" and "World" to the file on separate
lines, and closes the file.
D) Opens the "data.txt" file in write mode, appends "Hello" and "World" to the file on separate
lines, and closes the file.
80. Consider the following code snippet:
file = open("data.txt", "r")
for line in file:
print(line.strip())
file.close()
What does this code do?

A) Opens the "data.txt" file in read mode, reads and prints each line without any leading or
trailing whitespace, and closes the file.
B) Opens the "data.txt" file in read mode, reads and prints each line with leading and trailing
whitespace, and closes the file.
C) Opens the "data.txt" file in write mode, writes each line to the file without any leading or
trailing whitespace, and closes the file.
D) Opens the "data.txt" file in append mode, appends each line to the file with leading and
trailing whitespace, and closes the file.

14
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
DATA FILE HANDLING - BINARY FILES
81. Which of the following modes should be used when opening a binary file for reading?
a) "r" b) "rb" c) "read" d) "binary"

82. Which of the following code snippets correctly opens a binary file named "data.bin" in write mode
and writes binary data into it?
a) file = open("data.bin", "write")
file.write(b'\x00\x01\x02')
file.close()

b) file = open("data.bin", "wb")


file.write(b'\x00\x01\x02')
file.close()

c) file = open("data.bin", "w")


file.write(b'\x00\x01\x02')
file.close()

d) file = open("data.bin", "write_binary")


file.write(b'\x00\x01\x02')
file.close()
83. Which of the following is not true about binary files?

a) Binary files are store in terms of bytes

b) When you open binary file in text editor will show garbage values

c) Binary files represent ASCII value of characters

d) All of the above

84. What is the difference between wb and wb+ mode?

a) wb mode is used to open binary file in write mode and wb+ mode open binary file both for read
and write operation.
b) In wb mode file open in write mode and wb+ in read mode
c) File pointer is at beginning of file in wb mode and in wb+ at the end of file
d) No difference
85. The pickle module in Python is used for?

a) Serializing any Python object structure b) De-serializing Python object structure


c) Both a and b d) None of these

86. Which method is used to convert Python objects for writing data in binary file?

a) write() b) load() c) store() d) dump()

87. Which is not the valid mode for binary files?

a) r b) rb c) wb d) wb+

15
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
88. Which of the following function is used to read the data in binary file?

a) read() b) open() c) dump() d) load()


89. Which of the given method returns an integer that specifies the current position of the file object.

a) seek() b) load() c) position() d) tell()


90. What is the purpose of the seek() method in binary file handling?
a) To set the file pointer to a specific position. b) To read the entire contents of a binary file.
c) To write binary data to a file. d) To check if a file exists.

91. Which of the following code snippets correctly opens a binary file named "data.bin" in append
mode and appends binary data to it?

a) file = open("data.bin", "append")


file.write(b'\x03\x04\x05')
file.close()

b) file = open("data.bin", "ab")


file.write(b'\x03\x04\x05')
file.close()

c) file = open("data.bin", "a")


file.write(b'\x03\x04\x05')
file.close()

d) file = open("data.bin", "wb")


file.write(b'\x03\x04\x05')
file.close()
92. Which method is used to close a binary file in Python?
a) close() b) exit() c) terminate() d) end()

93. Which of the following statements is true about binary file handling in Python?
a) Binary files can only be read, not written.
b) Binary files can only be written, not read.
c) Binary files can be both read and written.
d) Binary files are not supported in Python.
94. What happens if you try to open a non-existent binary file in read mode?
a) An error is raised.
b) An empty binary file is created.
c) The file is created automatically.
d) The program continues to run without any issues.
95. Which method is used to check if the end of a binary file has been reached?
a) is_end_of_file() b) end_of_file() c) eof() d) at_end()

96. Which method is used to get the size of a binary file in Python?
a) get_size() b) size() c) file_size() d) os.path.getsize()

97. Which method is used to move the file pointer to the beginning of a binary file?
a) start() b) move_to_start() c) seek(0) d) seek(1)

98. What is the purpose of the flush() method in binary file handling?
a) To write binary data to a file.
16
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
b) To check if a file exists.
c) To get the current position of the file pointer.
d) To ensure that all data is written to the file.
99. What is the purpose of the is_closed() method in binary file handling?
a) To check if a binary file has been opened. b) To check if a binary file is read-only.
c) To check if a binary file exists. d) To check if a binary file has been closed.

100. Which of the following code snippets correctly opens a binary file named "data.bin" in read mode
and moves the file pointer to the 10th byte?

a) file = open("data.bin", "rb")


file.seek(10)
data = file.read()
file.close()

b) file = open("data.bin", "rb")


file.move_to(10)
data = file.read()
file.close()

c) file = open("data.bin", "rb")


file.start()
data = file.read()
file.close()

d) file = open("data.bin", "rb")


file.seek(1)
data = file.read()
file.close()

DATA FILE HANDLING - CSV FILES


101. Which module in Python is commonly used for CSV file handling?
a) os b) sys c) csv d) fileio

102. To open a CSV file in Python, which function should you use?
a) open() b) read_csv() c) csv.reader() d) load_csv()

103. How can you read a CSV file using the `csv` module in Python?
a) csv.read() b) csv.load() c) csv.reader() d) csv.open()

104. What is the delimiter character used in a CSV file by default?


a) Comma (`,`) b) Tab (`\t`) c) Pipe (`|`) d) Space (` `)

105. Which method is used to iterate over the rows of a CSV file using the `csv.reader()` object?
a) next() b) read() c) iterate() d) for loop

106. What does the `writerow()` method do in the `csv.writer` object?


a) Reads a row from a CSV file b) Writes a row to a CSV file
c) Deletes a row from a CSV file d) Modifies a row in a CSV file

17
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
107. How do you write a header row in a CSV file using the `csv.writer` object?
a) Use the `writeheader()` method b) Use the `write_row()` method
c) Use the `write()` method d) Use the `header()` method

108. Which function is used to write data to a CSV file in Python?


a) write_csv() b) save_csv() c) csv.writer() d) csv.write()

109. How can you specify a different delimiter character when writing a CSV file using the `csv.writer`
object?
a) It is not possible to change the delimiter
b) Use the `delimiter` parameter in the `csv.writer()` function
c) Use the `set_delimiter()` method after creating the `csv.writer` object
d) Use the `change_delimiter()` method before calling the `write()` method

110. How can you handle special characters in a CSV file using the `csv.writer` object?
a) Special characters are automatically handled
b) Use the `handle_special_chars()` method before calling the `write()` method
c) Use the `quotechar` parameter in the `csv.writer()` function
d) Special characters are not allowed in CSV files
111. What does the `newline` parameter in the `open()` function do when working with CSV files?
a) It specifies the character encoding of the CSV file
b) It sets the file mode to binary
c) It controls how universal newlines are handled
d) It indicates the number of newlines to append to the file
112. How can you close a CSV file after you have finished working with it?
a) Use the `close()` method on the `csv.reader` object
b) Use the `close()` method on the `csv.writer` object
c) Use the `close()` method on the file object returned by `open()`
d) CSV files are automatically closed when the program finishes
113. What is the recommended way to handle exceptions when working with CSV files?
a) Ignore exceptions as they are rare in CSV file handling
b) Use the `try-except` block to catch and handle exceptions
c) Use the `csv.exception()` function to handle exceptions
d) Exception handling is not necessary when working with CSV files
114. How can you skip the header row when reading a CSV file using the `csv.reader` object?
a) Use the `skip_header()` method before iterating over rows
b) Use the `skiprow` parameter in the `csv.reader()` function
c) Skip the first row manually in the `for` loop
d) CSV files do not have header rows
115. What is the purpose of the `Dialect` class in the `csv` module?
a) It defines the format of a CSV file
b) It provides methods to manipulate CSV files
c) It handles errors and exceptions in CSV file handling
d) The `Dialect` class is not used in the `csv` module
116. How can you read a CSV file into a list of dictionaries in Python?
a) Use the `csv.reader` object directly
b) Use the `csv.DictReader` object
c) Use the `read_csv()` function from the `pandas` library
d) Convert each row manually into a dictionary
117. 17. What is the difference between `csv.reader` and `csv.DictReader`?
a) `csv.reader` returns a list of lists, while `csv.DictReader` returns a list of dictionaries
b) `csv.reader` is used for reading CSV files, while `csv.DictReader` is used for writing CSV
files

18
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
c) There is no difference; they can be used interchangeably
d) `csv.reader` is a class, while `csv.DictReader` is a function
118. Which method is used to write a row of data in a CSV file using the `csv.DictWriter` object?
a) write_row() b) write_rowdata() c) write_dict() d) writerow()
119. How can you specify the fieldnames for a CSV file using the `csv.DictWriter` object?
a) Pass them as a list to the `fieldnames` parameter in the `csv.DictWriter()` function
b) Use the `set_fieldnames()` method after creating the `csv.DictWriter` object
c) Specify them as the first row in the CSV file
d) Fieldnames are not required when using the `csv.DictWriter` object
120. How can you handle quoted values in a CSV file using the `csv` module in Python?
a) Quoted values are automatically handled by the `csv.reader` object
b) Use the `handle_quoted_values()` method before reading the file
c) Use the `quotechar` parameter in the `csv.reader()` function
d) Quoted values are not supported in CSV files

DATA STRUCTURES
121 Process of inserting an element in stack is called _____________

a) Create b)Push c)Evaluation d)Pop

122 Process of removing an element from stack is called


a) Create b) Push c) Evaluation d)Pod

123 In a stack, if a user tries to remove an element from empty stack it is called _____________

a) Underflow b)Empty collection c)Overflow d)Garbage Collection

124 Pushinganelementintostackalreadyhavingfiveelementsandstacksizeof5,thenstackbecomes
a) Overflow b)Crash c)Underflow d) Userflow

125 Entries in a stack are “ordered”. What is the meaning of this statement?
a) A collection of stacks is sortable
b) Stack entries may be compared with the„<„operation
c) The entries are stored in a linked list
d) There is a Sequential entry that is one by one

126 Which of the following applications may use a stack?


a) A parentheses balancing program b)Tracking of local variables at runtime
c)Compiler Syntax Analyzer d) All of the mentioned

127 Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the
algorithm analyzes:
(()(())(()))are:
a) 1 b)2 c)3 d)4 or more

128 Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right
parentheses (in some order).The maximum number of parentheses that appear on the stack
AT ANY ONE TIME during the computation?
a) 1 b)2 c)3 d) 4 or more

19
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
129 What is the valueofthepostfixexpression6 32 4 +–*:
a) Something between -5and -15 b)Something between 5and -5
c)Something between 5 and 15 d)Something between 15 and
100

130 Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack
algorithm to convert the expression from infix to post fix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the
conversion of this expression?
a) 1 b)2 c)3 d)4

131 A linear list of elements in which deletion can be done from one end (front) and insertion can
take place only at the other end(rear)is known as a___________
a) Queue b)Stack c)Tree d) Linkedlist

132 A queue is a_____________


a) FIFO(First In First Out) list b) LIFO(Last In First Out)list
c)Ordered array d) Linear tree
133 If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in
what order will they be removed?
a) ABCD b) DCBA c)DCAB d) ABDC

134 A data structure in which elements can be inserted or deleted at / from both the ends but not in the
middle is?
a) Queue b) Circular queue c) Dequeue d) Priority queue

135 Any arithmetic expression can be represented in any of the notation.


a) Infix b) Prefix c)Postfix d) All the above.

136 What is the value of the postfix expression 6 3 2 4 + – *?


a) 1 b) 40 c) 74 d) -18

137 Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm
to convert the expression from infix to postfix notation. The maximum number of symbols that
will appear on the stack AT ONE TIME during the conversion of this expression?
a) 1 b) 2 c) 3 d) 4

138 Convert the following infix expressions into its equivalent postfix expressions.
(A + B ⋀ D)/(E – F)+G
a) (A B D ⋀ + E F – / G +) b) (A B D +⋀ E F – / G +)
c) (A B D ⋀ + E F/- G +) d) (A B D E F + ⋀ / – G +)

139 The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?


a) 600 b) 350 c) 650 d) 588
140 Convert the following Infix expression to Postfix form using a stack.
x + y * z + (p * q + r) * s,
Follow usual precedence rule and assume that the expression is legal.
a) xyz*+pq*r+s*+ b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+ d) xyzp+**qr+s*+

20
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
INTERFACE PYTHON WITH SQL, DATABASE MANAGEMENT SYSTEM

141 Which of the following package must be imported in Python to create a database connectivity
application?
a) mysql.connector b) mysql.connect c) sql.connector d) sql.execute

142 Which of the following component act as a container to hold all the data returned from the query
and from there we can fetch data one at a time?
a)ResultSet b). Cursor c.) Container d). Table

143 Which attribute of cursor is used to get number of records stored in cursor (Assuming cursor name
is mycursor)?
a. mycursor.count b. mycursor.row_count c. mycursor.records d. mycursor.rowcount

144 To make the changes made by any SQL Queries permanently in database, which function is used
after execution of the query ?
a) save() b) commit() c) execute() d) dump()

145 Which command is used to open the database “SCHOOL”?


a. USE SCHOOL b. OPEN SCHOOL c. USE DATABASE SCHOOL D.SHOW
SCHOOL

146 Which SQL keyword is used to retrieve only unique values?


a) DISTINCTIVE b) UNIQUE c) DISTINCT d) DIFFERENT

147 Which SQL keyword is used to sort the result-set?


a) SORT BY b) ORDER c) ORDER BY d) SORT

148 Which of the following function is used to FIND the largest value from the given data in MYSQL?
a) MAX () b) MAXIMUM () c) LARGEST () d) BIG ()

149 The data types CHAR (n) and VARCHAR (n) are used to create _______ and _______ types of
string/text fields in a database.
a) Fixed, equal b) Equal, variable c) Fixed, variable d) Variable, equal

150 SELECT name FROM stu WHERE subject LIKE „_______ Computer Science‟;
Which one of the following has to be added into the blank space to select the subject which has
Computer Science as its ending string?
a) $ b) _ c) || d) %

151 Consider following SQL statement. What type of statement is this?


DELETE FROM employee;
a) DML b) DDL c) DCL d) Integrity constraint

152 Which of the following function is not an aggregate function?


a) Round() b) Sum() c) Count () d) Avg ()

153 Select correct SQL query from below to find the temperature in increasing order of all cites(Table
name:weather).
a) SELECT city, temperature FROM weather ORDER temperature;
b) SELECT city, temperature FROM weather ASC;
c) SELECT city, temperature FROM weather ORDER BY temperature;
d) SELECT city, temperature FROM weather ORDER BY city;
21
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
154 An attribute in a relation is foreign key if it is the _________key in any other relation.
a) Candidate b) Primary c) Super d) Sub

155 In the given query which keyword has to be inserted?


INSERT INTO employee______(1002, “Kausar”, 2000);
a) Value b) Values c) Values into d) Into Values

156 SELECT name FROM class WHERE subject_____NULL;


Which comparison operator may be used to fill the blank space in above query?
a) = b) LIKE c) IS/IS Not d) if

157 Which SQL function is used to count the number of rows in a SQL query?
a) COUNT () b) NUMBER () c) SUM () d) COUNT (*)

158 Which operator is used to impose Condition Based on a list


a.LIKE b.IN c.IS d.WHERE

159 Which command is used to change the number of columns in a table?


a.UPDATE b.ADD c.ALTER d.RENAME

160 Which join combines each row from the first table with every row from the right table to make the
result set?
a. CROSS JOIN b.OUTER JOIN c. INNER JOIN d.EQUI JOIN

161 Which one of the following is not an aggregate function?


A. Min B. Sum C. With D. Avg

162 In SQL, this function returns the time at which the function executes:
A. SYSDATE B. NOW C. CURRENT D. TIME

163 Which type of values will not considered by SQL while executing the following statement?
SELECT COUNT(column name) FROM INVENTORY;
A. Numeric value B. Text value C. Null value D. Date value

164 Which of the following is a DDL command?


A.UPDATE B. INSERT C. DELETE D. ALTER
165 Raj, a Database Administrator, needs to display the average pay of workers from those departments
which have more than five employees. He is experiencing a problem while running the following
query:
SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
Which of the following is a correct query to perform the given task?
A. SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
B. SELECT DEPT,AVG(SAL) FROM EMP HAVING COUNT(*) > 5 GROUP BY DEPT;
C. SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT WHERE COUNT(*) > 5;
D. SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*)> 5;

166 The correct SQL from below to find the temperature in increasing order of all cities.
A. SELECT city FROM weather order by temperature;
B. SELECT city, temperature FROM weather;
C. SELECT city, temperature FROM weather ORDER BY temperature;
D. SELECT city, temperature FROM weather ORDER BY city;
22
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
167 Which of the following is not a category of MySQL functions?
A. Text Functions B. Mathematical Functions
C. Statistical Functions D. Arithmetic Functions

168 Where and Having clauses can be used interchangeably in SELECT queries?
A. True B. False C. Only in views D. With order by

169 Which SQL statement is used to display all the data from product table in the decreasing order of
price?
A. SELECT * FROM PRODUCT;
B. SELECT * FROM PRODUCT ORDER BY PRICE;
C. SELECT * FROM PRODUCT ORDER BY PRICE DESC;
D. SELECT * FROM PRODUCT ORDER BY DESC;

170 Which clause is used with “aggregate functions”?


A. GROUP BY B. SELECT C. WHERE D. Both A and B

COMPUTER NETWORKS

171 In computer networks, what does MAC stand for?


a) Media Access Control b) Master of Computer Science
c) Multi-Area Configuration d) Memory Access Controller

172 What was the first network that laid the foundation for the modern Internet?
a) ARPANET b) NSFNET c) INTERNET d) WWWNET

173 In which switching technique is data divided into small packets before transmission?
a) Circuit switching b) Packet switching
c) Virtual switching d) Frequency switching

174 What is the function of a protocol in data communication?


a) To define the physical media used for communication
b) To measure the bandwidth of a network connection
c) To facilitate the exchange of data between devices
d) To secure the transmission of data over the internet

175 What is the unit used to measure the data transfer rate of a communication channel?
a) Bandwidth b) Hertz c) Baud d) Mbps

176 Which transmission media is known for its high bandwidth and immunity to electromagnetic
interference?
a) Twisted pair cable b) Co-axial cable c) Fiber-optic cable d) Radio waves

177 What is the purpose of a modem in a computer network?


a) To connect devices within a local area network
b) To transmit data over long distances using radio waves
c) To convert digital signals to analog signals and vice versa
d) To route data packets between different networks

23
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
178 Which network device operates at the physical layer of the OSI model?
a) Repeater b) Hub c) Switch d) Router

179 .Which network topology connects all devices in a linear fashion?


a) Bus b) Star c) Tree d) Mesh

180 What does the acronym PAN stand for in computer networking?
a) Public Area Network b) Personal Area Network
c) Private Access Network d) Peer-to-Peer Network

181 Which protocol is used for transferring files over the internet?
a) HTTP b) FTP c) SMTP d) TCP/IP

182 What does the acronym IP stand for in IP address?


a) Internet Provider b) Internet Port
c) Internet Protocol d) Internet Proxy

183 Which network protocol is used for sending and receiving email?
a) PPP b) SMTP c) POP3 d) HTTPS

184 Which network protocol is used to establish a secure connection for websites?
a) FTP b) SMTP c) HTTPS d) TELNET

185 Which markup language is used for creating web pages?


a) HTML b) XML c) CSS d) PHP

186 What is the purpose of a URL in web browsing?


a) To identify the user's computer on the network
b) To specify the search keywords for a search engine
c) To provide the IP address of a web server
d) To specify the web page's address on the internet

187 What is the function of a web server?


a) To host websites and serve web pages to clients
b) To encrypt data transmitted over the internet
c) To convert IP addresses to domain names
d) To provide email services

188 Which network type covers a small geographical area, like an office or a building?
a) PAN b) LAN c) MAN d) WAN

189 Which network topology connects all devices to a central hub?


a) Bus b) Sta c) Tree d) Mesh

190 What does VoIP stand for in computer networking?


a) Voice over Internet Protocol b) Video over Internet Protocol
c) Virtual Office Internet Protocol d) Voice of Internet Providers

191 . Which device is used to regenerate the signals over long distance data transmission?
a)Switch b) Modem c) Repeater d) None of the above

192 Which one is False about MAC address?


a)It is Physical Address of any device connected to the internet.
b) We can change MAC address of a device.
24
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
c) It is the address of NIC card install in network device.
d) It is used for track the user‟s over internet.

193 A computer network created by connecting the computers of your school‟s computer lab is an
example of
a)LAN b) MAN c) WAN d) PAN

194 Which topology are all the nodes connected through a single coaxial cable?
a) Star b) Tree c) Bus d) Ring

195 . URL stands for


a) Universal Resource Locator b) Uniform Resource Locator
c) Universal Range Limit d) None of the above

196 An online activity that enables us to publish website or web application on the internet
a) Web server b) Web Browser c) Web Hosting d)None

197 Website stores the browsing activity through:


a) web page b) Cookies c) passwords d) server

198 The device used to connect two networks using different protocols is:
a) Router b) Repeater c) Gateway d)Hub

199 Which protocol allows you to make voice calls using a broadband Internet connection?
a)Chat b)ftp c)email d)VoIP

200 Microsoft edge is an example of __________________.


a)Web Page b) Web server c) Website d)Web Browser

25
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
ANSWERS TO MCQs

Q.NO 1 2 3 4 5 6 7 8 9 10
ANSWER B C A B A B A A A A
Q.NO 11 12 13 14 15 16 17 18 19 20
ANSWER B A D A A A D A A A
QNO 21 22 23 24 25 26 27 28 29 30
ANSWER D A B C B A B B A A
QNO 31 32 33 34 35 36 37 38 39 40
ANSWER D B A C B A A C B B
QNO 41 42 43 44 45 46 47 48 49 50
ANSWER A C C D A A C B C B
QNO 51 52 53 54 55 56 57 58 59 60
ANSWER A A B C A B A A A B
QNO 61 62 63 64 65 66 67 68 69 70
ANSWER B B B D B A A C A A
QNO 71 72 73 74 75 76 77 78 79 80
ANSWER C D A D A B C B A A
QNO 81 82 83 84 85 86 87 88 89 90
ANSWER B B C A C D A D D A
QNO 91 92 93 94 95 96 97 98 99 100
ANSWER B A C A C D C D D A
QNO 101 102 103 104 105 106 107 108 109 110
ANSWER C A C A D B A C B C
QNO 111 112 113 114 115 116 117 118 119 120
ANSWER C C B C A B A D A C
QNO 121 122 123 124 125 126 127 128 129 130
ANSWER B D A A D D C B D D
QNO 131 132 133 134 135 136 137 138 139 140
ANSWER A A A C D D D A B A
QNO 141 142 143 144 145 146 147 148 149 150
ANSWER A B D B A C C A C D
QNO 151 152 153 154 155 156 157 158 159 160
ANSWER B A C B B C D B C A
QNO 161 162 163 164 165 166 167 168 169 170
ANSWER C A C D D D D B C A
QNO 171 172 173 174 175 176 177 178 179 180
ANSWER A A B C D C C A A B
QNO 181 182 183 184 185 186 187 188 189 190
ANSWER B C B C A D A B B A
QNO 191 192 193 194 195 196 197 198 199 200
ANSWER V B A C B C B C D D

26
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
COMPETENCY BASED QUESTIONS

27
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
CLASS XI REVISION TOUR – CASE BASED QUESTIONS

1. You have a list of names ["Alice", "Bob", "Charlie", "David"]. You want to print only the names
that have more than 4 characters using a 'for loop'. Which of the following code snippets
accomplishes this?
a) names = ["Alice", "Bob", "Charlie", "David"]
for name in names:
if len(name) > 4:
print(name)
b) names = ["Alice", "Bob", "Charlie", "David"]
for i in range(len(names)):
if len(names[i]) > 4:
print(names[i])
c) names = ["Alice", "Bob", "Charlie", "David"]
for i in names:
if len(i) > 4:
print(i)
d) names = ["Alice", "Bob", "Charlie", "David"]
for name in range(names):
if len(name) > 4:
print(name)
2. You are building a program to analyze a given text string and count the occurrences of a specific
word within it. The word to be searched is provided by the user. You decide to use a 'for loop' to
iterate over each word in the string and compare it with the given word. Which of the following
code snippets correctly implements this functionality?
a) text = "The quick brown fox jumps over the lazy dog"
word = input("Enter a word to search: ")
count = 0
for char in text:
if char == word:
count += 1
print("Occurrences of the word:", count)
b) text = "The quick brown fox jumps over the lazy dog"
word = input("Enter a word to search: ")
count = 0
for word in text.split():
if word == word:
count += 1
print("Occurrences of the word:", count)
c) text = "The quick brown fox jumps over the lazy dog"
word = input("Enter a word to search: ")
count = 0
for word in text:
if word == word:
count += 1
print("Occurrences of the word:", count)
d) text = "The quick brown fox jumps over the lazy dog"
28
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
word = input("Enter a word to search: ")
count = 0
for word in text.split():
if word == word:
count += 1
print("Occurrences of the word:", count)
3. You are developing a program to store and analyze student data. Each student's information includes
their name, age, and grade. You decide to use tuples to represent each student's data. Which of the
following code snippets correctly defines a tuple for a student named "Alice" who is 16 years old
and in 11th class?

a) student_tuple = ("Alice", 16, 11)


b) student_tuple = ("Alice", (16, 11))
c) student_tuple = (("Alice", 16, 11))
d) student_tuple = ("Alice", 16), 11
4. You are working on a program that tracks the inventory of an online store. Each item in the
inventory has a unique item code as a key and a dictionary of details as its value, including the item
name, price, and quantity available. You want to add a new item to the inventory using a dictionary.
Which of the following code snippets correctly achieves this?
a) inventory = {}
item_code = input("Enter item code: ")
item_name = input("Enter item name: ")
item_price = float(input("Enter item price: "))
item_quantity = int(input("Enter item quantity: "))
item_details = {
"name": item_name,
"price": item_price,
"quantity": item_quantity
}
inventory[item_code] = item_details
b) inventory = {}
item_code = input("Enter item code: ")
item_name = input("Enter item name: ")
item_price = float(input("Enter item price: "))
item_quantity = int(input("Enter item quantity: "))
inventory[item_code] = {
"name": item_name,
"price": item_price,
"quantity": item_quantity
}
c) inventory = {}
item_code = input("Enter item code: ")
item_name = input("Enter item name: ")
item_price = float(input("Enter item price: "))
item_quantity = int(input("Enter item quantity: "))
item_details = {
item_name: "name",
item_price: "price",
item_quantity: "quantity"
}
inventory[item_code] = item_details

29
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
d) inventory = {}
item_code = input("Enter item code: ")
item_name = input("Enter item name: ")
item_price = float(input("Enter item price: "))
item_quantity = int(input("Enter item quantity: "))
item_details = dict(name=item_name, price=item_price, quantity=item_quantity)
inventory[item_code] = item_details
5. You are developing a program that stores information about books in a library. Each book has
attributes such as title, author, publication year, and availability status. You decide to use different
data types to represent these attributes. Which of the following code snippets correctly demonstrates
the usage of appropriate data types for the book attributes?
a) book = {
"title": "Python Programming",
"author": "John Doe",
"publication_year": "2020",
"availability": True
}
b) book = {
"title": "Python Programming",
"author": "John Doe",
"publication_year": 2020,
"availability": "Yes"
}
c) book = {
"title": "Python Programming",
"author": "John Doe",
"publication_year": 2020,
"availability": True
}
d) book = {
"title": "Python Programming",
"author": "John Doe",
"publication_year": "2020",
"availability": "Available"
}

Q.NO ANSWER
1. A
2. D
3. A
4. B
5. C

30
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
FUNCTIONS – CASE BASED QUESTIONS

1. You are tasked with creating a function that calculates the average of a list of numbers. Which of
the following code snippets correctly defines and calls this function?
a) def calculate_average(numbers):
total = sum(numbers)
average = total / len(numbers)
return average

result = calculate_average([1, 2, 3, 4, 5])


b) def calculate_average(numbers):
total = 0
for num in numbers:
total += num
average = total / len(numbers)
return average

result = calculate_average(1, 2, 3, 4, 5)
c) def calculate_average(*numbers):
total = 0
for num in numbers:
total += num
average = total / len(numbers)
return average

result = calculate_average([1, 2, 3, 4, 5])


d) def calculate_average(numbers):
total = 0
for num in range(len(numbers)):
total += numbers[num]
average = total / len(numbers)
return average

result = calculate_average((1, 2, 3, 4, 5))


2. You want to create a function that checks if a given string is a palindrome (reads the same forwards
and backwards). Which of the following code snippets correctly implements this function?
a) def is_palindrome(string):
reversed_string = string[::-1]
if string == reversed_string:
return True
else:
return False

result = is_palindrome("racecar")
b) def is_palindrome(string):
reversed_string = ""
31
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
for char in string:
reversed_string = char + reversed_string
if string == reversed_string:
return True
else:
return False

result = is_palindrome("hello")
c) def is_palindrome(string):
if string == string.reverse():
return True
else:
return False

result = is_palindrome("level")
d) def is_palindrome(string):
if string == string[::-1]:
return True
else:
return False

result = is_palindrome("python")
3. You are developing a program that requires a function to calculate the factorial of a given number.
Which of the following code snippets correctly defines and calls this function?
a) def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)

result = factorial(5)
b) def factorial(n):
result = 1
for i in range(1, n + 1):
result *= i
return result

result = factorial(5)

c) def factorial(n):
result = n
while n > 1:
n -= 1
result *= n
return result

result = factorial(5)

d) def factorial(n):
result = 1
while n > 0:
32
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
result *= n
n -= 1
return result

result = factorial(5)

4. You want to create a function that accepts a list of numbers and returns a new list containing only
the even numbers from the original list. Which of the following code snippets correctly implements
this function?
a) def get_even_numbers(numbers):
even_numbers = []
for num in numbers:
if num % 2 == 0:
even_numbers.append(num)
return even_numbers

reult = get_even_numbers([1, 2, 3, 4, 5])

b) def get_even_numbers(numbers):
even_numbers = []
for i in range(len(numbers)):
if numbers[i] % 2 == 0:
even_numbers.append(numbers[i])
return even_numbers

result = get_even_numbers([1, 2, 3, 4, 5])

c) def get_even_numbers(numbers):
even_numbers = []
for num in range(numbers):
if num % 2 == 0:
even_numbers.append(num)
return even_numbers

result = get_even_numbers([1, 2, 3, 4, 5])

d) def get_even_numbers(numbers):
even_numbers = []
for num in numbers:
if numbers % 2 == 0:
even_numbers.append(num)
return even_numbers

result = get_even_numbers([1, 2, 3, 4, 5])

5. You are creating a program that calculates the area of different shapes. You decide to create
separate functions for each shape. Which of the following code snippets correctly defines and calls
a function to calculate the area of a rectangle?
a) def calculate_rectangle_area(length, width):
area = length * width
return area

result = calculate_rectangle_area(5, 6)

33
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
b) def calculate_rectangle_area(side):
area = side * side
return area

result = calculate_rectangle_area(5)
c) def calculate_rectangle_area(length, width):
area = length + width
return area

result = calculate_rectangle_area(5, 6)
d) def calculate_rectangle_area(side):
area = side + side
return area

result = calculate_rectangle_area(5)
6 Anil, a student of class 12th, is learning Pythonfunctions . During examination, he has been
assigned an incomplete python code (shown below) for finding max of given two numbers. Help
him to complete the following code

defmax_of_two( x, y ):
if ______:
return x
else:
return y

a) X<Y b) X==Y c) X>Y d) X!=Y

7 Ravi, is a student of class 12th, is learning Python functions . During examination, he has been
assigned an incomplete python code (shown below) for finding Sum of numbers in the given list.
Help him to complete the following code

def sum(numbers):
total = 0
for x in numbers:
_________

return total
print(sum((8, 2, 3, 0, 7)))

a) total=+x b) total =x c) x=total d) total+=x

8 Mahesh, is a student of class 12th, is learning Python functions . During examination, he has been
assigned an incomplete python code (shown below) for searching element in the given list. Help
him to complete the following code

defSearch(Nums, ele):
if ele in Nums :
return ______
else:
return False
print(Srearch(Nums,20))

a) Ture b) False c) Present d) Not Found

34
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
9 Tarun, is a student of class 12th, is learning Python functions . During examination, he has been
assigned an incomplete python code (shown below) to check given string is a palindrome or not.
Help him to complete the following code

defPalindrome(Name):

if ______________:
return True
else:
return False

Name b) Name == Name[::-1] c) True d) Name==Name[::1]


10 Ravi, is a student of class 12th, is learning Python functions . During examination, he has been
assigned an incomplete python code (shown below) for finding Factorial of the given number. Help
him to complete the following code

def sum(N):
f=1
for x in _____:
f=f*x
return f

print(fact(5))

a) N b) range(N) c) range(1,N) d) range(1,N+1)

FUNCTIONS CASE BASED


QUESTIONS
QNO ANSWER
1. A
2. A
3. A
4. A
5. A
6 C
7 D
8 A
9 B
10 D

35
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
EXCEPTION HANDLING – CASE BASED QUESTIONS
1 You are building a calculator program that takes user input for two numbers and performs
arithmetic operations. Implement exception handling to handle cases where the user enters invalid
input.
Question:
How would you handle the scenario where the user enters a non-numeric value instead of a
number?
a) Use a try-except block to catch a `ValueError` and display an error message to the user.
b) Use a try-except block to catch a `TypeError` and display an error message to the user.
c) Use a try-except block to catch an `IndexError` and display an error message to the user.
d) Use a try-except block to catch a `SyntaxError` and display an error message to the user.
2 You are writing a program that reads data from a file and performs some calculations. Implement
exception handling to handle cases where the file does not exist.
Question:
How would you handle the scenario where the file specified by the user does not exist?
a) Use a try-except block to catch a `FileNotFoundError` and display an error message.
b) Use a try-except block to catch a `ValueError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch an `IndexError` and display an error message.
3 You are working on a program that receives network data. Implement exception handling to handle
cases where the network connection is lost.
Question:
How would you handle the scenario where the network connection is lost while receiving data?
a) Use a try-except block to catch a `ConnectionError` and attempt to reconnect.
b) Use a try-except block to catch a `ValueError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch an `IndexError` and display an error message.
4 You are building a web scraping program that extracts data from a website. Implement exception
handling to handle cases where the website is down or unreachable.
Question:
How would you handle the scenario where the website is down or unreachable?
a) Use a try-except block to catch a `ConnectionError` and display an error message.
b) Use a try-except block to catch a `FileNotFoundError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch a `ValueError` and display an error message.
5 You are writing a program that performs database operations. Implement exception handling to
handle cases where the database connection fails.
Question:
How would you handle the scenario where the database connection fails?
a) Use a try-except block to catch a `DatabaseError` and display an error message.
b) Use a try-except block to catch a `NameError` and display an error message.
c) Use a try-except block to catch a `SyntaxError` and display an error message.
d) Use a try-except block to catch a `ValueError` and display an error message.
6 The code shown below will result in an error if the input value is entered as -5. State whether this
statement is true or false.
assert False, 'Spanish'
a) True b) False
36
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
7 What is the output of the code shown below?
x=10
y=8
assert x>y, 'X too small'
a) Assertion Error b) 10 8 c) No output d) 108
8 What is the output of the code shown below?
#generator
def f(x):
yield x+1
g=f(8)
print(next(g))
a) 8 b) 9 c) 7 d) Error
9 What is the output of the code shown below?
def f(x):
yield x+1
print("test")
yield x+2
g=f(9)
a) Error b) test
c) test and 10 and 12 d) No output
10 What is the output of the code shown below?
def f(x):
yield x+1
print("test")
yield x+2
g=f(10)
print(next(g))
print(next(g))
a) No output b) 11 and test and 12
c) 11 and test d) 11

EXCEPTION HANDLING - CASE BASED QUESTIONS


QNO ANSWER
1. A
2. A
3. A
4. A
5. A
6 A
7 C
8 B
9 D
10 B

37
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
TEXT FILE HANDLING – CASE BASED QUESTIONS

1. Consider the following scenario:


You need to read the contents of a text file into a list in Python, excluding any empty lines. Which
approach should you take?

1. A) Read the file using `file.read()` and then remove empty lines using a loop.
2. B) Use the `file.readlines()` method to read the file into a list and remove empty lines using a
loop.
3. C) Use the `file.read().splitlines()` method to read the file into a list, which automatically excludes
empty lines.
4. D) Read the file using `file.read()` and then use the `filter()` function to remove empty lines from
the resulting list.
2. Consider the following scenario:
You are working on a project that involves reading a text file with a large number of lines. You want
to process the file line by line efficiently, without loading the entire file into memory. Which
approach should you use?

1. A) Use the `file.read()` method to read the entire file and then iterate over the lines.
2. B) Use the `file.readlines()` method to read all the lines at once and then iterate over them.
3. C) Iterate over the file object directly without using any specific method for reading the lines.
4. D) Use the `file.readline()` method inside a loop to read and process each line sequentially.
3. Consider the following scenario:
You need to write a list of strings to a text file, where each string should be written as a separate
line. Which approach is recommended for achieving this?

1. A) Use the `file.write()` method to write each string, followed by a line break character.
2. B) Concatenate the strings into a single string with line break characters and then use the
`file.write()` method.
3. C) Use the `file.writelines()` method, passing the list of strings as an argument, without any
additional characters.
4. D) Iterate over the list of strings and use the `file.write()` method for each string, followed by a
line break character.
4. Which of the following code snippets correctly demonstrates the usage of a `with` statement to
automatically close a file after reading its content?
a) file = open("data.txt", "r")
content = file.read()
print(content)
file.close()
b) with open("data.txt", "r") as file:
content = file.read()
print(content)
c) with open("data.txt", "r") as file
content = file.read()
print(content)
d) file = open("data.txt", "r")
content = file.read()
print(content)
close(file)
5. Which of the following code snippets correctly opens a text file named "log.txt" in append mode and
appends the string "Error: File not found!" to it?
a) file = open("log.txt", "a")
file.write("Error: File not found!")
38
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
file.close()

b) file = open("log.txt", "w")


file.write("Error: File not found!")
file.close()

c) file = open("log.txt", "r")


file.write("Error: File not found!")
file.close()

d) file = open("log.txt", "append")


file.write("Error: File not found!")
file.close()

TEXT FILES - CASE BASED QUESTIONS


QNO ANSWER
1. C
2. C
3. C
4. B
5. A

BINARY FILE HANDLING – CASE BASED QUESTIONS

1. Ravi is writing python code to complete the task:


A binary file “STUDENT.DAT” has structure (admission_number, Name, Percentage). Write a
function CountRec() in python that would read contents of the file “STUDENT.DAT” and display
the details of those students whose percentage is above 75. Also display number of students scoring
above 75%.

Help Ravi to complete the task by filling blanks with appropriate code.

import pickle
def ________________ # statement 1
fobj = open(“_________”, “___”) # statement 2
num = 0
try:
while True:
rec=________.load(fobj) # statement 3
if _____ > 75: # statement 4
print(rec[0], rec[1], rec[2])
num = num +1
_______ : # statement 5
fobj.close()
return num
Statement1
39
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
Countrec():
Statement 2
“STUDENT.DAT” , “wb”
Statement 3:
fobj
Statement 4
rec[2]
Statement 5
except EOFError
2. Mr. Kulveer loves programming. He joined an institute for learning. He is learning python. He
learned all the python concepts like strings, lists, tuple , dictionaries etc. but he wants to learn file
handling in python. He is trying to learn binary file handling. His teacher gave him partial code to
write and read data from employee.dat having structure empno, name, salary. Help Kulveer to
complete the code:

___________________ # statement 1
def addrecords():
fw= _____________ #statement 2
dict={}
ch=‟y‟
while ch==‟y‟:
eno=int(input(“enter employee number”))
nm= input(“enter employee name”)
sal=int(input(“enter employee salary”))
dict={„empno‟:eno,‟name‟:nm,‟salary‟:sal}
____________________ # statement 3
ch=input(“add more record”)
fw.close()
# function to diplay records
def display():
dict={}
fr= _____________ # statement 4
dict=____________ # statement 5
fr.close()
print(“data :”,dict)
Help Kulveer to import the module to perform binary file operation in statement 1.

a) csv
b) random
c) pickle
d) file

Which statement is used from the following for statement 2 to open the binary file in write
mode?

a) open(“employee.dat”,‟w‟)
b) open(“employee.dat”,‟wb‟)
c) open(“employee.dat”,‟w+‟)
d) open(“employee.dat”,‟r‟)

Which statement is used from the following for statement 3 to write dictionary data created in
above code, namely dict, is written in binary file employee.dat file?

a) pickle.dump(dict,fw)
40
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
b) pickle.write(dict,fw)
c) pickle.save(dict,fw)
d) pickle.store(dict)
Which statement is used from the following for statement 4 to open the binary file in read
mode?

a) open(“employee.dat”,‟r‟)
b) open(“employee.dat”,‟r+‟)
c) open(“employee.dat”,‟a‟)
d) open(“employee.dat”,‟rb‟)
Compelete statement 5 to read data in dictionary namely dict from the opened binary file?

a) dict=pk.read(fr)
b) dict=pickle.load(fr)
c) pickle.load(dict,fr)
d) none of these
3. Mr. Kulveer has given the following code to modify the records of employees from employee.dat
used in above code. He has to increase Rs. 2000 in the salary of those who are getting less than
15000. Mr. Kulveer has to find the records and change the salary in place. His teacher gave him
partial code. Help him to complete the code.

import pickle as pk
found=False
emp={}
fin = ___________ #1 statement : open file both in read write mode
# read from file
try:
while true:
pos= _______ #2 store file pointer position before reading record
emp=_______ #3 to read the record in emp dictionary
if emp[„salary‟]<15000:
emp[„salary‟]+=10000
_________ #4 place file pointer at exact location of record
pickle.dump(emp,fin)
found=True
except EOFError:
if found==False:
print(“record not found”)
else:
print(“successfully updated”)
fin.close()
In #1 statement open the file in read and write mode. Which statement is used out of the
followings?

a) open(“employee.dat”,‟rb+‟)
b) open(“employee.dat”,‟r+‟)
c) open(“employee.dat”,‟a‟)
d) open(“employee.dat”,‟rb‟)
Choose the appropriate statement to complete #2 statement to store file pointer position before
reading record.

a) pk.seek(pos)
b) fin.tell()
c) pk.position()
41
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
d) pk.tell()
Choose the appropriate statement to complete #3 statement to read record in emp dictionary.

a) pk.read(fin)
b) pickle.load(fin,emp)
c) pk.dump(emp)
d) pk.load(fin)
Choose the appropriate statement to complete #4 statement to place file pointer at exact
location of record

a) fin.seek(pos)
b) pos=fin.seek()
c) fin.position()
d) none of the above
4. Ms. Seema is working on a binary file and wants to write data from a list to a binary file.
Consider list object as l1, binary file suman_list.dat, and file object as f.

(i) Which of the following can be the correct statement for her?

a) f = open(“suman_list”,”wb”); pickle.dump(l1,f)
b) f = open(“suman_list”,”rb”); l1=pickle.dump(f)
c) f = open(“suman_list”,”wb”); pickle.load(l1,f)
d) f = open(“suman_list”,”rb”); l1=pickle.load(f)
(ii ) Which option will be correct for reading file for seema?

a) f = open(„suman_list‟,‟rb‟)
b) f = open(„suman_list‟,‟r‟)
c) f = open(„suman_list‟,‟r+‟)
d) f = open(„suman_list‟,‟ab‟)
(iii) In which of the file mode existing data will be intact in binary file?

a) a
b) ab
c) w
d) wb
(iv ) Which one of the following is correct statement?

a) import – pickle
b) pickle import
c) import pickle
d) All of the above
(v) What are the binary files used for?

a) It is used to store data in the form of bytes.


b) To store data
c) To look folder good
d) None of these
5. A Binary file Stock.dat has a structure [pno,pname,qty,price].A user defined function
Createfile() to input data for 3 records and add to stock.dat .There are some blanks help in
filling the gaps in the code:

Incomplete Code :

42
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
Import ___________ # Statement 1
def createfile():
File=open(“d:\\Stock.dat”,‟____‟) #Statement 2
pno=input(“Enter product no:”)
pname= input(“Enter product name:”)
qty= input(“Enter product quantity:”)
price= input(“Enter product price:”)
record=[pno,pname,qty,price]
_______________ # Statement 3
Print(“Record inserted”)
File.close()
createfile()
(i) Identify the suitable code for blank space in line marked as Statement-1.

a) csv
b) CSV
c) pickle
d) PICKLE
(ii) Identify the suitable code for blank space in line marked as Statement-2.

a) wb
b) ab
c) w
d) a
(iii) select correct statement to write data into file for Statement-3.

a) pickle.dump(record,file)
b) pickle.dump(record)
c) pickle.dump(file,record)
d) pickle.load(record,file)
(iv) Which method is used for object deserialization ?

a) Pickling
b) Unpickling
c) All of the above
d) None of the above
(v)What is the last action that must be performed on a file?

a) save
b) close
c) end
d) write

43
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
BINARY FILES - CASE BASED QUESTIONS
QNO ANSWER
1.
Statement1
Countrec():
Statement 2
“STUDENT.DAT” , “wb”
Statement 3:
fobj
Statement 4
rec[2]
Statement 5
except EOFError
2.
i. C
ii. B
iii. A
iv. D
v. B
3.
i. A
ii. B
iii. D
iv. B
4.
i. A
ii. A
iii. B
iv. C
v. A
5.
i. C
ii. B
iii. A
iv. B
v. B

44
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
CSV FILE HANDLING – CASE BASED QUESTIONS

1. The code given below inserts following record in to a table EMPLOYEE


EMPNO – Integer
ENAME – string
SALARY - Integer
BONUS - Integer
DEPTID – string
Write the following missing statements to complete the code
import ______________ # Statement1
mydb=mysql.connector.connect(host="localhost",user="root",passwd='root',database="class12")
mycursor= _____________ # Statement 2
mycursor.execute("INSERT INTO EMPLOYEE VALUES(114,'BP Singh',56400,800,'D01')")
___________________ # Statement 3
print(mycursor.rowcount, "Record inserted")
2. The Code given below is deleting a record from table EMPLOYEE
Fill in the blanks to complete the code

import mysql.connector
mydb=_______________(host="localhost",user="root",passwd='root',database="class12")
# statement 1
mycursor=mydb.cursor()
mycursor._____________("DELETE FROM EMPLOYEE WHERE EMPNO=114") #
statement 2
_______________ # statement 3

3. Mr. Rohan has written the given code in python that defines and calls the following user defined
functions.
Addrecord() – To add a student record to a CSV file Student.csv where each record contains a list
of field values ADMNO, NAME, CLASS ( reads values from keyboard)
Count() – To count the number of records present in file Student.csv
Help him to fill in the blanks to complete the program
import _____________ # statement 1
def Addrecord():
f=open("Student.csv","a",newline="")
wr= ______________ # statement 2
admno=int(input("Ente admission no: "))
name=input("Enter name :: ")
Class=int(input("Enter Class: "))
l=[admno,name,Class]
wr.
f.close()
def count():
f=open("Student.csv","r",newline="")
data=csv.reader(f)
d=list(data)
print(len(d))
f.close()

Addrecord()
count()
45
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
4. The program given below is to create a CSV file Employee.csv by suppressing EOL translation.
Each employee record contains a list of fields ENAME, DESIGNATION, SALARY
The writerows() method is adding 5 records to the file.

import csv
f=open( _____________ ) # statement 1
wr=csv. _____________ # statement 2
empdata=[["Rahul","Assistant",34000],
["Abhinav","Manager",67000],
["John","Clerk",23000],
["Vinod","Accountant",32000],
["Mahitha","Clerk",28000]]
wr.
f.close()
5. The code given below is searching and printing record in a file named “result10.csv”. each
record contains details in the order [rollno, name, result].
Fill in the blanks so that the program is correct and complete.

import _______ # statement 1


f = open("result10.csv",'r')
csv_reader= ___________ #statement 2
rollno = input("Enter Roll Number to be searched: ")
for row in ________: #statement 3
if(row[0]==rollno):
print(row)
f.close()

6 Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he
has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv'
(content shown below). Help him in completing the code which creates the desired CSV File.
CSV File
1,AKSHAY,XII,A
2,ABHISHEK,XII,A
3,ARVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ")
rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data) #Statement-5
fh.close()

46
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
i) Identify the suitable code for blank space in line marked as Statement-1.
a) csv file b) CSV c) csv d) Csv
Answer : c) csv

ii) Identify the missing code for blank space in line marked as Statement-2?
a) "School.csv","w" b) "Student.csv","w" c) "Student.csv","r" d) "School.csv","r"
Answer : b) "Student.csv","w"

iii) Choose the function name (with argument) that should be used in the blank space of line
marked as Statement-3
a) reader(fh) b) reader(MyFile) c) writer(fh) d) writer(MyFile)
Answer : c) writer(fh)

iv) Identify the suitable code for blank space in line marked as Statement-4.
a) 'ROLL_NO', 'NAME', 'CLASS', 'SECTION' b) ROLL_NO, NAME, CLASS, SECTION
c) 'roll_no','name','Class','section' d) roll_no,name,Class,sectionc) co.connect()
Answer : d) roll_no,name,Class,section

v) Choose the function name that should be used in the blank space of line marked as Statement-5
to create the desired CSV File?
a) dump() b) load() c) writerows() d) writerow()
Answer : c) writerows()

7 Aman is working in an IT company writing a program to add record in an already existing


CSV file “stud.csv”. He has written the following code. As a friend of Aman, help him to
complete the code given below.

__________________ #Statement-1
fn = open(_____, _____, newline='') #Statement-2
sdata = csv._____ #Statement-3
temp = [ ]
sid = int(input("Enter Student Id : "))
sname = input("Enter Student Name : ")
class = input("Enter Class : ")
record = [ _____ ] #Statement-4
temp.___________ (record) #Statement-5
sdata. dump ( ___________ ) #Statement-6
fn.close()

1. Fill in the blank for statement1:

(a) load CSV


(b) read csv
(c) import csv
(d) import CSV

Ans. (c) import csv

2.Fill in the blank for statement2:

(a) "stud .csv", "wb"


(b) "stud .csv", "a"
(c) "stud .csv", "w"
47
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
(d) "stud .cvs", "a"

Ans. (b) “stud .csv”, “a”

3.Fill in the blank for statement3:

(a) writer(fn)
(b) reader(fn)
(c) readline(fn)
(d) writeline(fn)

Ans. (a) writer(fn)

4.Fill in the blank for statement4:

(a) Sid, Sname, Class


(b) sid, sname, class
(c) SID,SNAME,CLASS
(d) “sid”, ”sname”, "class”

Ans.(d) “sid”, ”sname”, “class”

5.Fill in the blank for statement5:

(a) add
(b) writes
(c) append
(d) dump

Ans. (c) append

6.Fill in the blank for statement6:

(a) record
(b) temp
(c) fn
(d) csv

Ans. (b) temp


8 Srishti is a class 12 Computer Science student. She has been assigned an incomplete python
code (shown below) to create a CSV file „book.csv‟ and display the file content (as shown
below). Help her to complete the following code.
CSV File

bookid, subject, class


b1, Hindi, VI
b2, Science, VII
b3, Math, VI
import____________ #Statement-1
fn = open(____________, __________) #Statement-2
fno = csv._________ #Statement-3
fno.writerow(["bookid","subject", "class"])
fno.writerow(["b1", "Hindi", "VI"])
48
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
fno.writerow(["b2", "Science", "VII"])
fno.writerow(["b3", "Math", "VI"])
fn.____________ #Statement-4
_______ open("book.csv","r") as fn: #Statement-5
rd=csv._________ #Statement-6
for rec in rd:
print(rec)
fn.close()

1. Choose the correct code for Statement1.

a. csv
b. CSV
c. cvs
d. csv file

Ans. a. csv

2. Choose the correct code for Statement2.

a. "book.csv", "r"
b. "book.csv", "w"
c. "book.csv file", "w"
d. "book", "w"

Ans. b. “book.csv”, “w”

3. Choose the correct code for Statement3.

a. reader(fn)
b. read(book)
c. writer(fn)
d. write(fn)

Ans. c. writer(fn)

4. Choose the correct code for Statement4.

a. dump( )
b. close( )
c. exit( )
d. end( )

Ans. b. close( )

5. Choose the correct code for Statement5.

a. fn =
49
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
b. with
c. With
d. as
Ans. b. with

6.Choose the correct code for Statement6.

a. readlines(fn)
b. read(fn)
c. readrows()
d. reader(fn)
Ans. d. reader(fn)

9 Amit, a student of class 12th is trying to write a program to search the record from
“data.csv” according to the admission number input from the user. Structure of record saved
in “data.csv” is Adm_no, Name, Class, Section, Marks. He has written the partial code and
has missed out certain statements, You as an expert
of Python have to provide the answers of missing statements based on the following code of
Amit.
Ans.

import _____________________ #Statement1


f = open(__________________) #Statement2
d=csv._______________________(f) #Statement3
next(f) #To Skip Header Row
k=0
adm = int(input("Enter admission number"))
for row in d:
if int(row[0])_______________adm: #Statement4
print("Adm no = ", row[0])
print("Name = ", row[___________]) #Statement5
print("Class = ", row[2])
print("Section = ", row[3])
print("Marks = ", row[4])
break
_____________ : #Statement6
print("Record Not Found")

1. Choose the correct module for Statement1.

a. CSV
b. Csv
c. Picke
d. csv
Ans. d. csv

2. Choose the correct code for Statement2

a. "data.csv", "r"
b. "data.csv", "w"
50
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
c. "data.csv", "a"
d. "data.csv", "wb"
Ans. a. “data.csv”, “r”

3. Choose the correct function for Statement3

a. Reader
b. reader( )
c. reader
d. read

Ans. c. reader

4. Choose the correct operator for Statement4

a. >
b. >=
c. ==
d. !=

Ans. c. ==

5. Choose the correct index for Statement5.

a. 0
b. 1
c. 2
d. 3

Ans. b. 1

6. Choose the correct selection statement for Statement6.

a. if
b. else
c. elif
d. if-

Ans. b. else

51
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
CSV FILES - CASE BASED QUESTIONS
QNO ANSWER
1.
Statement 1:
mysql.connector

Statement 2:
mydb.cursor()

Statement 3:
mydb.commit()
2.
Statement 1:
mysql.connector.connect

Statement 2:
execute

Statement 3:
mydb.commit()
3.
Statement 1:
csv

Statement 2:
csv.writer(f)

Statement 3:
writerow(l)
4.
Statement 1:
"Employee.csv","w",newline=""

Statement 2:
writer(f)

Statement 3:
writerows(empdata)

5.
Statement 1:
csv

Statement 2:
csv.reader(f)

Statement 3:
csv_reader

52
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
DATABASE MANAGEMENT SYSTEMS - CASE STUDY QUESTIONS:

Q1. ) Study the following table(s)


Courier
CNO CRec CSen Amount CDat City
159 Vicky Jack 250 01-Jan-2018 Los Angeles
245 Sam Kate 220 11-Feb-2019 Paris
358 Alex Sam 315 30-Apr-2018 London
468 Louis Simmy 160 01-Mar-2018 Los Angeles
576 Terry Jane 190 01-Aug-2019 Mexico
688 Lima Roger 200 03-Nov-2019 Mexico
790 Rosy Richard 200 21-Jul-2019 Los Angeles
894 Luke Richard 325 17-May-2018 London
940 Elizabeth Nicole 150 15-Jan-2019 Paris
999 Nicolas Longmen 100 10-Jul-2019 Paris

1.Write the queries of the following:


i. To display crec, cdate and city of all the couriers in decreasing order or amount
ii.To view the number of couriers with amount more than 200.
iii.To view total amount for each city from the table courier
2. Write the output of the following:
iv. Select cno, crec, from courier where city like „P%‟;
v.Select count(cno) from courier where csen like „R%‟;
vi.Select max(amount). Min(amount) from courier;

Q2) Write SQL commands for the queries (i) to (iv) based on the tables DRESS and MATERIAL.

DRESS
DCODE DESCRIPTION PRICE MCODE LAUNCHDATE
10001 FORMAL SHIRT 1250 M001 12–JAN–08
10020 FROCK 750 M004 09–SEP–07
10012 INFORMAL SHIRT 1450 M002 06–JUN–08
10019 EVENING GOWN 850 M003 06–JUN–08
10090 TULIP SKIRT 850 M002 31–MAR–07
10023 PENCIL SKIRT 1250 M003 19–DEC–08
10089 SLACKS 850 M003 20–OCT–08
10007 FORMAL PANT 1450 M001 09–MAR–08
10009 INFORMAL PANT 1400 M002 20–OCT–08
10024 BABY TOP 650 M003 07–APR–08

53
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
MATERIAL
MCODE TYPE
M001 TERELENE
M002 POLYESTER
M003 SILK
M004 COTTON
(i) To display DCODE and DESCRIPTION of an each dress in ascending order of DCODE.
(ii) To display the details of all the dresses which have LAUNCHDATE in between 05–
DEC–07 and 20–JUN–08 (inclusive of both the dates).
(iii) To display the average PRICE of all the dresses which are made up of material with MCODE
as M003.
(iv) To display material wise highest and lowest price of dresses from DRESS table.
(Display MCODE of each dress along with highest and lowest price)
Q3) Write the SQL command for the following on the basis of given table.
Table : SPORTS

i)Display the names of the students who have grade „A‟ in either Game 1 or Game 2 or both.
ii)Display the number of students having the GRADE1 as „A‟ in Game1.
iii)Display the names of students who have same game for both Game1 and Game2.
iv)Display the games taken by the students whose name starts with „A‟
v) Give the output of the following sql statements as per table given above.
i) SELECT COUNT(*) FROM SPORTS.
ii) SELECT DISTINCT Class FROM SPORTS.
iii) SELECT MAX(Class) FROM STUDENT;
vi) SELECT COUNT(*) FROM SPORTS GROUP BY Game1;

Q4) The given program is used to connect python with MySQL and show all the data present in the table
“stmaster” from the database “oraclenk”. You are required to complete the statements so that the code
can be executed properly.
import _____.connector __ pymysql #STATEMENT1
dbcon=pymysql._____________(host=”localhost”,user=”root”,________=”sia@1928”)
#STATEMENT2
if dbcon.isconnected()==False
print(“Error in establishing connection:”)
cur=dbcon.______________() #STATEMENT3
query=”select * from stmaster”
cur.execute(_________)#STATEMENT4
54
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
resultset=cur.fetchmany(3)
for row in resultset:
print(row)
dbcon.______() #STATEMENT5

Q5) Consider the following tables EMPLOYEE and DEPARTMENT and answer (a) and (b) parts of
this question.

TABLE: EMPLOYEE

TCode TName DepCde Salary Age JoinDate


15 Sameer 123 75000 39 01-Apr-2007
Sharma
21 Ragvinder K 101 86000 29 11-Nov-2005
3 Rama Gupta 119 52500 43 03-Mar-2010
46 CR Menon 103 67000 38 12-Jul-2004
77 Mohan Kumar 103 63000 55 25-Nov-2000
81 Rajesh Kumar 19 74500 48 11-Dec-2008
8 Sanjeev P 101 92600 54 12-Jan-2009
93 Pragya Jain 123 32000 29 05-Aug-2006

TABLE :DEPARTMENT

DepCde DepName DepHead


101 ACCOUNTS Rajiv Kumar
103 HR P K Singh
119 IT Yogesh Kumar
123 RESEARCH Ajay Dutta

1. Write SQL commands for the following statements:

i) To display all DepName along with the DepCde in descending order of DepCde.
ii) To display the average age of Employees in DepCde as 103.
iii) To display the name of DepHead of the Employee named “Sanjeev P”
iv) To display the details of all employees who has joined before 2007 from EMPLOYEE
table.

2. Give the output of the following SQL queries:

i) SELECT COUNT (DISTINCT DepCde) FROM EMPLOYEE;


ii) SELECT MAX(JoinDate), MIN (JointDate) FROM EMPLOYEE;
iii) SELECT TName, DepHead FROM EMPLOYEE E, DEPARTMENT D
WHERE E.DepCde = D.DepCde;
iv) SELECT COUNT (*) FROM EMPLOYEE WHERE Salary > 60000 AND Age > 30;

55
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
DATABASE MANAGEMENT SYSTEMS - CASE STUDY ANSWERS:

Q1) (i) select crec, cdate, city from courier order by amount desc;
(ii) Select count(cno) from courier where amount>200;
(iii) Select sum(amount) , city from courier group by city ;
(iv)
Cno Crec
245 Sam
940 Elizabeth
999 Nicolas

v)
Count(Cno)
3

(vi)
Max (amount) Min(amount)
325 100

Q2) (i) Select DCODE, DESCRIPTION from DRESS order by DCODE DESC
(ii) select * from DRESS where LAUNCHDATE >= 05–DEC–07 and LAUNCHDATE<=20–
JUN–08
(iii)Select avg(PRICE) from DRESS where MCODE=M003
(iv)select DESCRIPTION, PRICE, MCODE from DRESS order by PRICE DESC, MCODE ASC)
Q3) i) Select Name from SPORTS where Grade1=‟A‟ OR Grade2=‟A‟;
ii)Select count(*) from SPORTS group by GAME1 having GRADE1=‟A‟;
iii)Select Name from SPORTS where Game1=Game2;
iv)Select Game1,Game2 from SPORTS where Name LIKE „A%‟;
v) i)6
ii)4
iii)10
iv)2 2 1 1
Q4)
import mysql.connector as pymysql
dbcon=pymysql.connect(host=”localhost”, user=”root”, passwd=”sia@1928”)
if dbcon.isconnected()==False
print(“Error in establishing connection:”)
cur=dbcon.cursor()
query=”select * from stmaster”
cur.execute(query)
resultset=cur.fetchmany(3)
for row in resultset:
print(row)
dbcon.close()

56
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
Q5) (1)

I. SELECT DEPNAME, DEPARTMENT.DepCde FROM EMPLOYEE, DEPARTMENT


WHERE EMPLOYEE. DepCDE=DEPARTMENT. DepCde Order by DepCde DESC;
II. Select AVG (Age) from EMPLOYEE WHERE DepCde=”103″;
III. SELECT DeptHead FROM DEPARTMENT WHERE Employee. TName=“Sanjeev P”
AND EMPLOYEE. DepCde= DEPARTMENT. DepCde;
IV. SELECT * from EMPLOYEE WHERE joinDate<‟01-JAN-2007′;

(2) i) COUNT(DISTINCT DepCde)/4

ii) Max (JoinDate) Min (JoinDate)

03 Mar-2010 12-Jul-2004

iii)

TName DepHead

Sameer Sharma Ajay Dutta

RaguvindraK | Rajiv
Kumar

Rama Gupta Yogesh


Kumar

CR Menon PK Singh

Rajesh Kumar Yogesh


Kumar

Sanjeev P Rajiv
Kumar

Pragya Jain Ajay Dutta

iv) 5

57
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
COMPUTER NETWORKS - CASE BASED QUESTIONS:

Q
Innovation Hub India is a knowledge community aimed to uplift the standard of skills
1.
and knowledge in the society. It is planning to setup its training centres in multiple
towns and villages of India with its head offices in the nearest cities. They have created
a model of their network with a city, a town and 3 villages as given.
As a network consultant, you have to suggest the best network related solution for
their issues/problems raised in (i) to (v) keeping in mind the distance between
various locations and given parameters.

Note:
* In Villages, there are community centres, in which one room has been given as a training center
to this organization to install computers.
* The organization has got financial support from the government and top IT companies.
i.Suggest the most appropriate location of the SERVER in the YHUB (out of the 4 locations), to
get the best and effective connectivity. Justify your answer.
58
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
ii. Suggest the best wired medium and draw the cable layout (location to location) to efficiently
connect various locations within the YHUB.

iii. Which hardware device will you suggest to connect all the computers within each location of
YHUB?

iv. Which server/protocol will be most helpful to conduct live interaction of Experts from Head
office and people at YHUB locations?

v. Suggest a device/software and its placement that would provide data security for the entire
network of the YHUB.

Q Shyamji Marketing Ltd. has four branches in its campus named Udaipur, Kota, Jodhpur and Ajmer.
2. Shyamji Marketing Ltd. wants to establish the networking between all the four offices. A rough
layout of the same is as follows:

Udaipur
Jodhpur Office
Office

Kota
Ajmer Office
Office

Approximate distances between these offices as per network survey team are as follows:

Place From Place To Distance


Udaipur Jodhpur 30 m
Jodhpur Kota 40 m
Kota Ajmer 25 m
Udaipur Ajmer 150 m
Jodhpur Ajmer 105 m
Udaipur Kota 60 m

In continuation of the above, the company experts have planned to install the
following number of computers in each of their offices:

Udaipur 40
Jodhpur 80
Kota 200
Ajmer 60

i. Suggest the most suitable place (i.e., Block/Centre) to install the server of this organization
59
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
with a suitable reason.

ii. Suggest an ideal layout for connecting these blocks/centre for a wired connectivity.

iii. Which device will you suggest to be placed/installed in each of these offices to efficiently
connect all the computers within these offices?

iv. Suggest the placement of a Repeater in the network with justification.

v. The organization is planning to connect its new office in Delhi, which is more than 1250 km
current location. Which type of network out of LAN, MAN, or WAN will be formed? Justify
your answer.

3. TQ CONSULTANTS is a professional consultancy company. The company is planning to set up


new offices in India with its hub at Gurugram. As a network adviser, you have to understand their
requirements and suggest to them the best available solutions.

Block-to-Block distance (in Mtrs.):

Block (From) Block (To) Distance

Human Resources Conference 60

Human Resources Finance 60

Conference Finance 120

Expected Number of Computers to be installed in each block:

Block Computers

Human Resources 125

Conference 25

Finance 60

i. What will be the most appropriate block where organization should plan to install their server?

ii.Draw a block-to-block cable layout to connect all the buildings in the most appropriate manner
for efficient communication.

60
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
iii.What will be the best possible connectivity out of the following to connect the new set-up of
offices in Nagpur with its London base office?
(i) Co-axial cable (ii) Satellite Link (iii) Ethernet Cable

iv.Which of the following devices will you suggest to connect each computerin each of the above
buildings?
(i)Gateway (ii) Switch (iii) Modem

v.Write names of any two popular OpenSource Software which are used asOperating Systems.

4. WeLearn University is setting up its academic blocks at Raipur and is planning to set
up a network. The University has 3 academic blocks and one Human Resource Centre
as shown in the diagram below:

Center to Center distances between various blocks/center is as follows:

Law Block to business Block 40m


Law block to Technology Block 80m
Law Block to HR centre 105m
Business Block to technology
30m
Block
Business Block to HR Centre 35m
Technology block to HR centre 15m

No. of Computers in each block.

Law Block 15
Technology Block 40
HR centre 115
Business Block 25

i. Suggest the most suitable place (i.e., Block/Centre) to install the server of this University with
a suitable reason.

ii. Suggest an ideal layout for connecting these blocks/centre for a wired connectivity.

61
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
iii. Which device will you suggest to be placed/installed in each of these blocks/centre to
efficiently connect all the computers within these blocks/centre

iv. Suggest the placement of a Repeater in the network with justification.

v. The university is planning to connect its admission office in Delhi, which is more than 1250km
from university. Which type of network out of LAN, MAN, or WAN will be formed? Justify
your answer

5. Hindustan Connecting World Association is planning to start their offices in four major cities
inIndiatoprovideregionalITinfrastructuresupportinthefieldofEducation&Culture.Thecompany has
planned to set up their head office in New Delhi in three locations and have namedtheir New Delhi
offices as “Sales Office” , “Head Office” and “Tech Office”.
The company‟s regionaloffices are located at “Coimbatore”, “Kolkata” and “Ahmedabad”. A rough
layout of the same is asfollows:

Approximatedistancebetweentheseofficesaspernetworksurveyteamisasfollows:

PlaceFrom PlaceTo Distance


HeadOffice SalesOffice 10KM
HeadOffice TechOffice 70KM
HeadOffice KolkataOffice 1291KM
HeadOffice AhmadabadOffice 790 KM
HeadOffice CoimbatoreOffice 1952KM

In
continuationoftheabove,thecompanyexpertshaveplannedtoinstallthefollowingnumberofcomputersin
eachoftheiroffices:

HeadOffice 100
SalesOffice 20
TechOffice 50
KolkataOffice 50
AhmadabadOffice 50
CoimbatoreOffice 50

i)Suggest network type(out of LAN,MAN,WAN) for connecting each of the following set of their
offices:
a. Head Office and Tech Office
b. Head Office and Coimbatore Office

ii)Which device you will suggest to be produced by the company for connecting all the computers
with in each of their offices out of the following devices?
a. Modem
b. Telephone
62
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
c. Switch/Hub

iii)Which of the following communication media, will suggest to be procured by the company for
connecting their local offices in New Delhi for very effective and fast communication?
a. Ethernet Cable
b. Optical Fibre
c. Telephone Cable

iv)Suggest a cable/writing layout for connecting the company‟s local offices located in New Delhi.

v) Suggest the most suitable place (i.e., Block/Office) to install the server of this Company with a
suitable reason.

COMPUTER NETWORKS - ANSWERS:

1. i) YTOWN
Justification:-Since it has the maximum number of computers.
ii) Optical Fiber

Layout:

iii) Switch or Hub


iv)Video conferencing or VoIP or any other correct service/protocol
v) Firewall - Placed with the Server at YHUB.

2. i) KOTA, Maximum Computers


ii) Any suitable layout
iii) Switch
iv)Udaipur to Ajmer Block if direct connection is there(largest distance)
v)WAN: spread over more than one city

3. i) Human Resource
ii)

63
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD
iii) Satellite Link
iv) Switch
v) Linux, Ubuntu, Open Solaris or any other Open Source O/s

4. i) Most suitable place to install the server is HR center, as this center has
maximumnumber of computers

ii)

iii) Hub / Switch


iv) Law Block to HR centre (Repeater may be placed when the distance
between 2 buildings is more than 100meter.)

v) WAN, as the given distance is more than the range of LAN and MAN.

5. i) a. The type of network between the Head Office and Tech Office is LAN
(Local Area Network).
b.The type of network between the Head Office andCoimbatore Office is WAN
(Wide Area Network).
ii)c. The suitable device for connecting all the computers in each of their offices is
switch/hub.
iii)b.Optical Fibre
iv)The suggested layout for connection is as follows:

v) Head Office

64
CLASS 12 COMPUTER SCIENCE SUPPORT MATERIAL 2023-24 KVS RO HYDERABAD

You might also like