COMPUTER SCIENCE QP - SET 2
COMPUTER SCIENCE QP - SET 2
General Instructions:
This question paper contains five sections: A, B, C, D, and E.
Section A consists of 18 questions carrying 1 mark each. text of correct answer should also be written.
Page 1 of 5
6.What is the difference between list and tuple in Python?
a. Lists are immutable, and tuples are mutable b. Tuples are immutable, and lists are mutable
c. Both are immutable d. Both are mutable
15.____ are set of rules that need to be followed to establish data communication over network.
a. Application b. InterNetwork c. Presentation d.Protocols
Page 2 of 5
Question 17 and 18 are assertion based questions select the correct choice as
a. Both Assertion (A) and Reasoning (R) are true, and (R) is the correct explanation of (A).
b. Both Assertion (A) and Reasoning (R) are true, but (R) is not the correct explanation of (A).
c. Assertion (A) is true, but Reasoning (R) is false.
d. Assertion (A) is false, but Reasoning (R) is true.
17. Assertion (A): In SQL, the NOW() function is used to retrieve the current date and time.
Reasoning (R): The NOW() function returns the system's current date and time in the format YYYY-MM-DD
HH:MM:SS.
18. Assertion (A): CSV files are used to store tabular data in plain text format.
Reasoning (R): Each line in a CSV file represents a record, with values separated by a comma, and it is a
commonly used format for data exchange.
Section B (7 × 2 = 14 Marks)
19. Differentiate between guided and unguided transmission media with examples.
20. Write a Python function is_prime(n) to check whether a given number is prime or not.
21. Explain the differences between HAVING and WHERE clauses in SQL with examples.
22. Write a Python program to reverse a string using stack data structure.
23. What is DNS? How is it important in computer networks?
24. Explain the significance of HTTP, HTTPS in web communication.
OR
List one advantage and disadvantage of Mesh topology.
25. Write a command to create a table Students with the following structure:
- RollNo (Integer, Primary Key)
- Name (String)
- Marks (Float)
Section C (5 × 3 = 15 Marks)
26. Write a Python program to count the number of vowels in a given string.
28. Write a Python program to write all even number between 1to100 in num.txt.
OR
Write python program to push even number from a given list VALUES to the stack EvenNumbers.
Page 3 of 5
29. Explain Circuit switching and packet switching.
Section D (3 × 4 = 12 Marks)
31. Predict the following code output.
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
OR
Predict the output of the following code:
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,’#’,end=” ”)
print()
33. A university campus has three blocks: Administrative Block, Academic Block, and Hostel Block.
The distances between these blocks are as follows:
• Administrative Block to Academic Block: 120 meters
• Administrative Block to Hostel Block: 250 meters
• Academic Block to Hostel Block: 300 meters
Each block has the following number of computers:
• Administrative Block: 25 computers
• Academic Block: 50 computers
• Hostel Block: 40 computers
The university wants to set up a network to connect all three blocks and ensure efficient communication.
Page 4 of 5
Answer the following:
1. Suggest the most suitable cable type to connect the blocks, considering the distances.
2. Identify a network device required to connect all computers within each block.
3. Which type of network (LAN, MAN, or WAN) will be formed? Justify your answer.
4. Suggest a suitable topology for interconnecting the blocks and justify your choice.
Section E (2 × 5 = 10 Marks)
34. Write a Python program to perform the following tasks:
a) Read a file named data.txt.
b) Count the number of words in the file.
c) Write the word count into another file named count.txt.
OR
Write a Python program to perform the following operations using the MySQL connector:
a)Connect to a MySQL database named SchoolDB password=”mysql”.
b)Create a table named Student with the following structure:
• RollNo (Integer, Primary Key)
• Name (Varchar(50))
• Marks (Float)
c)Insert the following three records into the table:
• (101, 'Ankit', 85.5)
• (102, 'Riya', 92.0)
• (103, 'Soham', 76.0)
d)Retrieve and display all records from the Student table.
35. A company wants to analyze the sales performance of its employees. Write a Python program that uses a
binary file to store employee names and their sales amounts. Perform the following:
a) Add new employee sales data.
b) Update existing sales data.
c) Display the sales data.
OR
A csv file "CountriesHIndex.csv" contains the data of a survey. Each record of the file contains the
following data: Name of a country, Population of the country, Sample Size (Number of persons who
participated in the survey in that country),Happy (Number of persons who accepted that they were
Happy) For example, a sample record of the file may be: [‘Finland’, 5673000, 5000, 3426] Write
the following Python functions to perform the specified operations on this file:
(a) Read all the data from the file in the form of a list and display all those records for which the
population is more than 5000000.
(b) Count the number of records in the file.
***
Page 5 of 5