Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

12th CS Worksheet-1 12 Nov

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

Class: XII Session: 2024-25

Computer Science (083)

Worksheet -1

Marks: 40 Date-12/11/2024

1. State True or False 1


“Variable declaration is implicit in Python.”

2. Which of the following is an invalid datatype in Python? 1


(a) Set (b) None (c)Integer (d)Real

3. Given the following dictionaries 1

dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}

Which statement will merge the contents of both dictionaries?


a. dict_exam.update(dict_result)
b. dict_exam + dict_result
c. dict_exam.add(dict_result)
d. dict_exam.merge(dict_result)

4. Consider the given expression: 1


not True and False or True
Which of the following will be correct output if the given expression is
evaluated?

(a) True
(b) False
(c) NONE
(d) NULL

5. Select the correct output of the code: 1


a = "Year 2022 at All the best"

1
a = a.split('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)

(a) Year . 0. at All the best


(b) Year 0. at All the best
(c) Year . 022. at All the best
(d) Year . 0. at all the best

6. Which of the following mode in file opening statement results or 1


generates an error if the file does not exist?

(a) a+ (b) r+ (c) w+ (d) None of the above

7. Fill in the blank: 1

command is used to remove primary key from the table in SQL.

(a) update (b)remove (c) alter (d)drop

8. Which of the following commands will delete the table from MYSQL 1
database?
(a) DELETE TABLE
(b) DROP TABLE
(c) REMOVE TABLE
(d) ALTER TABLE

9. Which of the following statement(s) would give an error after 1


executing the following code?

S="Welcome to class XII" # Statement 1


print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5

(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5

10. Fill in the blank: 1

is a non-key attribute, whose values are derived from the


primary key of some other table.
(a) Primary Key
(b) Foreign Key
(c) Candidate Key

2
(d) Alternate Key

11. The correct syntax of seek() is: 1


(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)
12. Fill in the blank: 1
The SELECT statement when combined with clause,
returns records without repetition.

(a) DESCRIBE
(b) UNIQUE
(c) DISTINCT
(d) NULL

13. Fill in the blank: 1


is a communication methodology designed to deliver both voice
and multimedia communications over Internet protocol.

(a) VoIP (b) SMTP (c) PPP (d)HTTP

14. What will the following expression be evaluated to in Python? 1


print(15.0 / 4 + (8 + 3.0))

(a) 14.75 (b)14.0 (c) 15 (d) 15.5

15. Which function is used to display the total number of records from 1
table in a database?
(a) sum(*)
(b) total(*)
(c) count(*)
(d) return(*)

16. To establish a connection between Python and SQL database, 1


connect() is used. Which of the following arguments may not
necessarily be given while calling connect() ?

(a) host
(b) database
(c) user
(d) password

Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
(a) Both A and R are true and R is the correct explanation for A

3
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True

17. Assertion (A):- If the arguments in function call statement match the 1
number and order of arguments as defined in the function definition,
such arguments are called positional arguments.
Reasoning (R):- During a function call, the argument list first contains
default argument(s) followed by positional argument(s).

18. Assertion (A): CSV (Comma Separated Values) is a file format for data 1
storage which looks like a text file.
Reason (R): The information is organized with one record on each line
and each field is separated by comma.

19. Rao has written a code to input a number and check whether it is 2
prime or not. His code is having errors. Rewrite the correct code and
underline the corrections made.

def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)

20. Write two points of difference between Circuit Switching and Packet 2
Switching.

OR

Write two points of difference between XML and HTML.

21. (a) Given is a Python string declaration: 1


myexam="@@CBSE Examination 2022@@"

Write the output of: print(myexam[::-2])

1
(b) Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())

22. Explain the use of ‘Foreign Key’ in a Relational Database Management 2


System. Give example to support your answer.

4
23. (a) Write the full forms of the following: 2
(i) SMTP (ii) PPP

(b) What is the use of TELNET?

24. Predict the output of the Python code given below: 2

def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1

NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')

OR

Predict the output of the Python code given below:

tuple1 = (11, 22, 33, 44, 55 ,66)


list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

25. Differentiate between count() and count(*) functions in SQL with 2


appropriate example.

OR

Categorize the following commands as DDL or DML:


INSERT, UPDATE, ALTER, DROP

26. (a) Consider the following tables – Bank_Account and Branch: 1+2

Table: Bank_Account
ACode Name Type
A01 Amrita Savings
A02 Parthodas Current
A03 Miraben Current

5
Table: Branch

ACode City
A01 Delhi
A02 Mumbai
A01 Nagpur

What will be the output of the following statement?

SELECT * FROM Bank_Account NATURAL JOIN Branch;

(b) Write the output of the queries (i) to (iv) based on the table,
TECH_COURSE given below:

Table: TECH_COURSE
CID CNAME FEES STARTDATE TID
C201 Animation and VFX 12000 2022-07-02 101
C202 CADD 15000 2021-11-15 NULL
C203 DCA 10000 2020-10-01 102
C204 DDTP 9000 2021-09-15 104
C205 Mobile Application 18000 2022-11-01 101
Development
C206 Digital marketing 16000 2022-07-25 103

(i) SELECT DISTINCT TID FROM TECH_COURSE;


(ii) SELECT TID, COUNT(*), MIN(FEES) FROM
TECH_COURSE GROUP BY TID HAVING COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE
FEES>15000 ORDER BY CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE
FEES BETWEEN 15000 AND 17000;
27. Write a method COUNTLINES() in Python to read lines from text file 3
‘TESTFILE.TXT’ and display the lines which are not starting with any
vowel.
Example:

If the file content is as follows:


An apple a day keeps the doctor away.

We all pray for everyone’s safety.


A marked difference will come in our country.
The COUNTLINES() function should display the output as:

The number of lines not starting with any vowel - 1

6
Q.28

28. (a) Write the outputs of the SQL queries (i) to (iv) based on the 3
relations Teacher and Placement given below:

Table : Teacher

T_ID Name Age Department Date_of_join Salary Gender


1 Arunan 34 Computer Sc 2019-01-10 12000 M
2 Saman 31 History 2017-03-24 20000 F
3 Randeep 32 Mathematics 2020-12-12 30000 M
4 Samira 35 History 2018-07-01 40000 F5
Raman 42 Mathematics 2021-09-05 25000 M 6
Shyam 50 History 2019-06-27 30000 M
7 Shiv 44 Computer Sc 2019-02-25 21000 M
8 Shalakha 33 Mathematics 2018-07-31 20000 F

Table : Placement
P_ID Department Place
1 History Ahmedabad
2 Mathematics Jaipur
3 Computer Sc Nagpur

(i) SELECT Department, avg(salary) FROM Teacher


GROUP BY Department;
ii) SELECT MAX(Date_of_Join),MIN(Date_of_Join) FROM
Teacher;
ii) SELECT Name, Salary, T.Department, Place FROM
Teacher T, Placement P WHERE T.Department =
P.Department AND Salary>20000;
iv) SELECT Name, Place FROM Teacher T, Placement P

7
WHERE Gender =’F’ AND T.Department=P.Department;
(b) Write the command to view all tables in a database.

8
9
10
11

You might also like