0% found this document useful (0 votes)
37 views49 pages

QB For Final Revision - CS - XII - 2021 Part-2

Uploaded by

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

QB For Final Revision - CS - XII - 2021 Part-2

Uploaded by

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

Computer Science

[Question Bank for Easy Revision – Part 2]

[QB/XII/083/Easy Revision - 2021]


QB/XII/083/Easy Revision – 2021/Part-2
Descriptive Questions:
1. What is a function in Python?
2. Differentiate between actual parameters and formal parameters. Also give a suitable example for
the same.
3. Differentiate between value and reference parameters. Also give a suitable example for the same.
4. What is meant by the scope of a variable?
5. Differentiate between local and global variables. Write an example script to explain the same.
6. What is the use of keyword global?
7. Can a function have a local variable with the same name as that of a global variable in the script?
If yes, then is it possible to access global variable with the same name in that function? If yes, how?
8. What is the use of return statement in a function? In which three cases does a function return
None?
9. What is the difference between mutable and immutable data objects being passed as arguments
to a function?
10. What is a function header? Give an example.
11. With reference to function func() in the code given below, identify
(i) function header, (ii) function call(s), (iii) arguments (actual parameters), (iv) parameters (formal
parameters), (v) function body
def func(x):
global b
y=b+2
b*=y
y+=x+b
print(x,y,b)
x,b=5,10
func(x)
print(func(x))
12. What is a python module? Give an example of an inbuilt python module.
13. What is a python package? Give an example of a python package.
14. Write Python statement(s) to import:
(i) A function alpha() from a module named myModule.
(ii) Functions comp1() and comp2() from a module named Computer
(iii) A package pkg from a library lib.
(iv) Module Salary from a package HR
(v) Package named Trigonometry.
15. What is a file?
16. Why do we need files?
17. What are two main categories of file types?
18. What is the difference between a text file and a binary file?
19. What are the two basic operations which are performed on a file?
20. What is a file buffer?
21. How can a file be opened in a Python program?
22. What are different file opening modes for a text file in Python? Write, in brief, what does each mode
do?
23. Differentiate between ‘write’ mode and ‘append’ modes of files in Python.
24. What different functions are available to write data in a text file? Describe each in brief.
25. What different functions are available to write read data from a text file? Describe each in brief.
26. Why is it important to close a file?
27. In which mode should a file be opened:
(i) To write data into an existing file.
(ii) To read data from a file
(iii) To create a new file and write data into it.
(iv) To write data into an existing file. If the file does not exist, then file should be created to
write data into it.
28. Differentiate between seek() and tell().
29. What is the difference between a binary file and a text file?

QB/XII/083/Easy Revision - 2021 1 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
30. Which functions are used to (i) rename a file, (ii) delete a file? In which module are these functions
available?
31. What are the three standard input-output streams in Python?
32. Define the terms ‘pickling’ and ‘unpickling’.
33. What is a stack?
34. Define the terms TOP, PUSH, POP in context of stacks.
35. How can a stack be implemented in Python?
36. Define the terms Overflow and Underflow in context of stacks.
37. What is a csv file? How is it different from a plain text file?
38. Define connection and cursor w.r.t. Python interface with an SQL database.
39. What is the role of fetchone() method?
40. What is the function of fetchall() method?
41. What is the function of fetchmany() method?
42. Find the correct identifiers out of the following, which can be used for naming variable or functions
in a Python program:
While, for, Float, new, 2ndName, A%B, Amount2, _Counter
43. Find the correct identifiers out of the following, which can be used for naming Variable or Functions
in a Python program:
For, while, INT, NeW, delete, 1stName, Add+Subtract, name1
44. Out of the following, find those identifiers, which cannot be used for naming variables functions in
a C++ program:
_Cost, Pr*Qty, float, Switch, Address One, Delete, Number12, in
45. Out of the following, find those identifiers, which cannot be used for naming variables or functions
in a C++ program:
Total Tax, float, While, S.I. NeW, switch, Column31, _Amount

Finding the Errors:


1. Find error(s), if any, in each of the following code snippets in Python:
(i) def f1[a,b]
a+=b
b=*a
print(a,b)
x,b=5
f1(x)
(ii) define f2(x):
Global b
x+=b
b+==x+2
print(x,y,b)
x,b=5,10
f2(b)

(iii) def f3(a=1,b):


global x, global y
x=a+b
a,a*x=a+x,y
print(a,b,x,y)
f3[5,10]
print(f3[5])

2. Why will the following code raise an exception?


def f1()
with open("abc.txt",'r') as f:
for i in range(10):
f.write(str(i))
f.close()
f1()

QB/XII/083/Easy Revision - 2021 2 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
Finding the Output:
1. Find output of each of the following code snippets in Python:
(i) def f1(a,b):
a+=b
b*=a
print(a,b)
x,b=5,10
f1(x,b)
print(x,b)

(ii) def f2(x,y):


global b
x+=b
b*=y
y+=x+y
print(x,y,b)
x,b=5,10
f2(x,b)
print(x,b)

(iii) def f3(a,b):


global x,y
x=a+b
a,y=a+x,a*x
print(a,b,x,y)
f3(5,10)
print(f3(b=x,a=y))

(iv) def f4(s):


for ch in s:
if ch in 'aeiou':
print('*',end='')
elif ch in ['AEIOU']:
print('#',end='')
elif ch.isdigit():
print(s[0],end='')
else: print(s[-1],end='')
f4('India91')
print()
f4('KUwait965')
print()

(v) def f5(s):


s1=''
for i in range(len(s)):
if s[i]==s[-1-i]:
s1+=s[i]
else: s1=s[i]+s1
print(s1)
f5('abcba')
f5('abcaba')

QB/XII/083/Easy Revision - 2021 3 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(vi) def f6(x=5, y=10):
global a
x+=x+y
y=y+a
a+=a+x
print(x,y,a)
a=4
f6(y=a)
f6(a,a+1)

(vii) def f7(str1):


str2=''
diff=ord('a')-ord('A')
for ch in str1:
if ch>='A' and ch<='Z':
ch=chr(ord(ch)+diff)
elif ch>='a' and ch<='z':
ch=chr(ord(ch)-diff)
else:
ch='#'
str2+=ch
print(str2)
f7('R@ti0n@L')

2. What will be the content of file abc.txt after execution of the following code?
def f1():
for i in range(10):
f=open("abc.txt",'w')
f.write(str(i))
f.close()
f1()

Differentiate between:
1. Import random and from random import random
2. import math and from math import sqrt

Writing code:
1. Write a function in Python which takes three numbers as parameters and returns the largest of
these three numbers. The function should not use in-built max() function.
2. Write a function in Python which takes a string as a parameter and returns the reversed string
without using slicing.
3. Write a function in Python which takes a string of comma separated words as parameter and
returns a comma separated string in which the words of given string are sorted. For example, if the
given string is "Maths,English,Physics,Chemistry", then the returned string should be:
"Chemistry,English,Maths,Physics".

Text File Operations


1. Consider the following code:
ch = "A"
f=open("data.txt",'a')
f.write(ch)
print(f.tell())
f.close()
What is the output if the file content before the execution of the program is the string "ABC"?
(Note that " " are not the part of the string)

QB/XII/083/Easy Revision - 2021 4 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
2. Write a function to count and display the number of blanks present in a text file named
“PARA.TXT”.
3. Write a single statement to display the contents of a text file named "abc.txt"
4. Assuming that a text file named TEXT1.TXT already contains some text written into it, write a
function named vowelwords(), that reads the file TEXT1.TXT and creates a new file named
TEXT2.TXT, which shall contain only those words from the file TEXT1.TXT which don’t start
with an uppercase vowel (i.e., with ‘A’, ‘E’, ‘I’, ‘O’, ‘U’). For example, if the file TEXT1.TXT
contains
Carry Umbrella and Overcoat When It rains
Then the text file TEXT2.TXT shall contain
Carry and When rains
5. Write a function in PYTHON to count the number of lines ending with a vowel from a text file
“STORY.TXT’.
6. Write a function in PYTHON to count and display the number of words starting with alphabet ‘A’
or ‘a’ present in a text file “LINES.TXT”.
Example:
If the file “LINES.TXT” contains the following lines,
A boy is playing there. There is a playground.
An aeroplane is in the sky.
Are you getting it?
The function should display the output as 5.
7. Write a function in PYTHON to display the last 3 characters of a text file “STORY.TXT’.
8. Write a function copy() that will copy all the words starting with an uppercase alphabet from an
existing file “FAIPS.TXT” to a new file “DPS.TXT”.
9. Write a function show(n) that will display the nth character from the existing file “MIRA.TXT”. If
the total characters present are less than n, then it should display “invalid n”.
10. Write a function in PYTHON that counts the number of “Me” or “My” words present in a text file
“DIARY.TXT”. If the “DIARY.TXT” contents are as follows:
My first book was Me and My
Family. It gave me chance to be
Known to the world.
The output of the function should be:
Count of Me/My in file: 4 (CBSE 2011)
11. Write a function in PYTHON to read the contents of a text file “Places.Txt” and display all those
lines on screen which are either starting with ‘P’ or with ‘S’. (CBSE 2013)
12. Write a function CountHisHer() in PYTHON which reads the contents of a text file “Gender.txt”
which counts the words His and Her (not case sensitive) present in the file.
For, example, if the file contains:
Pankaj has gone to his friend’s house. His frien’s name is Ravya. Her house is
12KM from here.
The function should display the output:
Count of His: 2
Count of Her: 1 (CBSE 2012)
13. Write a function EUCount() in PYTHON, which should read each character of a text file
IMP.TXT, should count and display the occurrences of alphabets E and U (including small cases
e and u too).
Example:
If the file content is as follows:
Updated information
Is simplified by official websites.
The EUCount() function should display the output as:
E:4
U:1 (CBSE 2014)

QB/XII/083/Easy Revision - 2021 5 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
14. Write function definition for SUCCESS( ) in PYTHON to read the content of a text file
STORY.TXT, count the presence of word SUCCESS and display the number of occurrence of
this word. (CBSE- Delhi 2015)
Note :
– The word SUCCESS should be an independent word
– Ignore type cases (i.e. lower/upper case)
Example :
If the content of the file STORY.TXT is as follows :
Success shows others that we can do it. It is possible to
achieve success with hard work. Lot of money does not mean
SUCCESS.
The function SUCCESS( ) should display the following :

15. Write function definition for TOWER() in PYTHON to read the content of a text file
WRITEUP.TXT, count the presence of word TOWER and display the number of occurrences of
this word. (CBSE-Outside Delhi 2015)
Note :
‐ The word TOWER should be an independent word
‐ Ignore type cases (i.e. lower/upper case)
Example:
If the content of the file WRITEUP.TXT is as follows:

Tower of hanoi is an interesting problem.


Mobile phone tower is away from here. Views
from EIFFEL TOWER are amazing.

The function TOWER () should display the following:


3

16. Write the function definition for WORD4CHAR() in PYTHON to read the content of a text file
FUN.TXT, and display all those words, which have four characters in it.
(CBSE- Delhi 2016)
Example:
If the content of the file Fun.TXT is as follows:
When I was a small child, I used to play in the
garden with my grand mom. Those days were amazingly
funful and I remember all the moments of that time

The function WORD4CHAR() should display the following:

When used play with days were that time

QB/XII/083/Easy Revision - 2021 6 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
17. Write function definition for DISP3CHAR() in PYTHON to read the content of a text file
KIDINME.TXT, and display all those words, which have three characters in it.
(CBSE-Outside Delhi 2016)
Example:
If the content of the file KIDINME.TXT is as follows:

When I was a small child, I used to play in the garden


with my grand mom. Those days were amazingly funfilled and I
remember all the moments of that time

The function DISP3CHAR() should display the following:

was the mom and all the

18. Write a function in Python to copy the contents of a text file into another text file. The names of
the files should be input from the user.
19. Write a function in Python which accepts two text file names as parameters. The function should
copy the contents of first file into the second file in such a way that all multiple consecutive
spaces are replaced by a single space. For example, if the first file contains:
Self conquest is the
greatest victory .
then after the function execution, second file should contain:
Self conquest is the
greatest victory .

20. Write a function in Python to input a multi-line string from the user and write this string into a file
named ‘Story.txt’. Assume that the file has to be created.

21. Write a function to display the last line of a text file. The name of the text file is passed as an
argument to the function.

22. Write a function which takes two file names as parameters. The function should read the first
file (a text file), and stores the index of this file in the second file (a binary file). The index should
tell the line numbers in which each of the words appear in the first file. If a word appears more
than once, the index should contain all the line numbers containing the word.

23. Write a Python function to read and display a text file 'BOOKS.TXT'. At the end display number
of lowercase characters, uppercase characters, and digits present in the text file.

24. Write a Python function to display the size of a text file after removing all the white spaces
(blanks, tabs, and EOL characters).

Binary File Operations


1. Following is the structure of each record in a data file named ”PRODUCT.DAT”.
{"prod_code":value, "prod_desc":value, "stock":value}
The values for prod_code and prod_desc are strings, and the value for stock is an integer.
Write a function in PYTHON to update the file with a new value of stock. The stock and the
product_code, whose stock is to be updated, are to be input during the execution of the
function.

2. Given a binary file “STUDENT.DAT”, containing records of the following type:


[S_Admno, S_Name, Percentage]
Where these three values are:
S_Admno – Admission Number of student (string)
S_Name – Name of student (string)
Percentage – Marks percentage of student (float)

QB/XII/083/Easy Revision - 2021 7 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
Write a function in PYTHON that would read contents of the file “STUDENT.DAT” and
display the details of those students whose percentage is above 75.

3. Assuming the tuple Vehicle as follows:


(vehicletype, no_of_wheels)
Where vehicletype is a string and no_of_wheels is an integer.
Write a function showfile() to read all the records present in an already existing binary file
SPEED.DAT and display them on the screen, also count the number of records present in the
file.

4. Write a function in PYTHON to search for a BookNo from a binary file “BOOK.DAT”, assuming
the binary file is containing the records of the following type:
{"BookNo":value, "Book_name":value}
Assume that BookNo is an integer.
5. Assuming that a binary file VINTAGE.DAT contains records of the following type, write a
function in PYTHON to read the data VINTAGE.DAT and display those vintage vehicles,
which are priced between 200000 and 250000. (CBSE 2012)
[VNO, VDesc, price]

6. Write a function in PYTHON to search for a laptop from a binary file “LAPTOP.DAT” containing
the records of following type. The user should enter the model number and the function should
display the details of the laptop. (CBSE 2011)
[ModelNo, RAM, HDD, Details]
where ModelNo, RAM, HDD are integers, and Details is a string.

7. Write a function in PYTHON to search for the details (Number and Calls) of those mobile
phones which have more than 1000 calls from a binary file “mobile.dat”. Assuming that this
binary file contains records of the following type:
(Number,calls)

8. Write a function in PYTHON to read the records from binary file GAMES.DAT and display the
details of those games, which are meant for children of AgeRange “8 to 13”. Assume that the
file GAMES.DAT contains records of the following type: (CBSE 2013)
[GameCode, GameName, AgeRange];

9. Write a function in PYTHON to read each record of a binary file ITEMS.DAT, find and display
those items which costs less than 2500. Assume that the file ITEMS.DAT is created with the
help of objects of the following type: (CBSE-Delhi 2015)
{"ID":string, "GIFT":string, "Cost":integer};

10. Write a definition for function BUMPER() in PYTHON to read each object of a binary file
GIFTS.DAT, find and display details of those gifts, which have remarks as “ON DISCOUNT”.
Assume that the file GIFTS.DAT is created with the help of lists of following type:
(ID, Gift, Remarks, Price)
(CBSE- Delhi 2016)

Stacks
1. Write functions stackpush(nameStack) to insert a new name and stackpop(nameStack) to
delete a name from a stack implemented using a list. The list is passed as an argument to
these functions.
2. Each element of a stack ITEM (a list) is a list containing two elements BNo (integer), and
Description (String). Write functions to push an element in the stack and to pop an element
from the stack. The popped element should be returned by the function. If the stack is empty,
the pop function should return None.

QB/XII/083/Easy Revision - 2021 8 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
3. Each element of a stack TEXTBOOKS (a list) is a dictionary with keys 'ISBN', 'TITLE', and
'PRICE'. The values for 'ISBN', 'TITLE', and 'PRICE' are of type integer, string, and float
respectively. Write functions:
(i) PUSH(TEXTBOOKS) to push an element in the stack. The details of the book to be
pushed are to be input from the user.
(ii) POP(TEXTBOOKS) to pop an element from the stack. The popped element should
be returned by the function. If the stack is empty, the pop function should return
None.
4. Consider a stack S as follows:

Assuming standard definitions of functions PUSH() and POP(), redraw the stack after
performing the following set of operations:
POP(S)
POP(S)
PUSH(S,8)
PUSH(S,3)
POP(S)

5. Consider the following stack named COLORS:


Redraw the stack after each of the following operations:

(i) POP() (ii) PUSH('Black') (iii) PUSH('Pink') (iv) POP() (v) PUSH('Green')

2. RDBMS – Descriptive Questions


(i) Give a suitable example of a table with sample data and illustrate Primary and Candidate keys in
it. (CBSE 2012)
(ii) What is the difference between degree and cardinality of a table? What is the degree and cardinality
of the following table: (CBSE 2013)
ENo Name Salary
101 John Fedrick 45000
103 Raya Mazumdar 50600

(iii) Give a suitable example of a table with sample data and illustrate Primary and Alternate keys in it.
(iv) Observe the following table carefully and write the names of the most appropriate columns, which
can be considered as (i) candidate keys and (ii) primary key. (CBSE-Delhi 2015)
Id Product Qty Price Transaction
Date
101 Plastic Folder 12" 100 3400 2014-12-14
104 Pen Stand Standard 200 4500 2015-01-31
105 Stapler Medium 250 1200 2015-02-28
109 Punching Machine Big 200 1400 2015-03-12
103 Stapler Mini 100 1500 2015-02-02

(v) Observe the following table carefully and write the names of the most appropriate columns, which
can be considered as (i) candidate keys and (ii) primary key. (CBSE-Outside Delhi 2015)

Code Item Qty Price Transaction Date

QB/XII/083/Easy Revision - 2021 9 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
1001 Plastic Folder 14” 100 3400 2014‐12‐14
1004 Pen Stand Standard 200 4500 2015‐01‐31
1005 Stapler Mini 250 1200 2015‐02‐28
1009 Punching Machine Small 200 1400 2015‐03‐12
1003 Stapler Big 100 1500 2015‐02‐02

(vi) Observe the following STUDENTS and EVENTS tables carefully and write the name of the RDBMS
operation which will be used to produce the output as shown in LIST. Also, find the Degree and
Cardinality of the LIST. (CBSE- Delhi 2016)

STUDENTS EVENTS
No Name EVENTCODE EVENTNAME
1 Tara mani 1001 Programming
2 Jaya Sarkar 1002 IT Quiz
3 Tarini Trikha

LIST
NO NAME EVENTCODE EVENTNAME
1 Tara mani 1001 Programming
1 Tara mani 1002 IT Quiz
2 Jaya Sarkar 1001 Programming
2 Jaya Sarkar 1002 IT Quiz
3 Tarini Trikha 1001 Programming
3 Tarini Trikha 1002 IT Quiz

(vii) Observe the following PARTICIPANTS and EVENTS tables carefully and write the name of the
RDBMS operation which will be used to produce the output as shown in RESULT. Also, find the
Degree and Cardinality of the RESULT. (CBSE- Outside Delhi 2016)
PARTICIPANTS EVENTS
PNo Name EVENTCODE EVENTNAME
1 Aruanabha Tariban 1001 IT Quiz
2 John Fedricks 1002 Group Debate
3 Kanti Desai

RESULT
PNO NAME EVENTCODE EVENTNAME
1 Aruanabha Tariban 1001 IT Quiz
1 Aruanabha Tariban 1002 Group Debate
2 John Fedricks 1001 IT Quiz
2 John Fedricks 1002 Group Debate
3 Kanti Desai 1001 IT Quiz
3 Kanti Desai 1002 Group Debate

3. SQL – Writing queries and finding outputs


(i) Write SQL commands for the following queries based on the relation Teacher given
below:
No Name Age Department Date_of_join Salary Sex
1 Jugal 34 Computer 10/01/97 12000 M
2 Sharmila 31 History 24/03/98 20000 F
3 Sandeep 32 Maths 12/12/96 30000 M
4 Sangeeta 35 History 01/07/99 40000 F
5 Rakesh 42 Maths 05/09/97 25000 M
6 Shyam 50 History 27/06/98 30000 M
7 Shiv Om 44 Computer 25/02/97 21000 M
8 Shalakha 33 Maths 31/07/97 20000 F

QB/XII/083/Easy Revision - 2021 10 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
a) To show all information about the teacher of History department.
b) To list the names of female teachers who are in Maths department.
c) To list the names of all teachers with their date of joining in ascending order.
d) To display teacher’s name, salary, age for male teachers only.
e) To count the number of teachers with Age>23.
(ii) Given the following relation: STUDENT
No. Name Age Department Dateofadm Fee Sex
1 Pankaj 24 Computer 10/01/97 120 M
2 Shalini 21 History 24/03/98 200 F
3 Sanjay 22 Hindi 12/12/96 300 M
4 Sudha 25 History 01/07/99 400 F
5 Rakesh 22 Hindi 05/09/97 250 M
6 Shakeel 30 History 27/06/98 300 M
7 Surya 34 Computer 25/02/97 210 M
8 Shikha 23 Hindi 31/07/97 200 F
Write SQL commands for the following queries
a) To show all information about the students of History department.
b) To list the names of female students who are in Hindi department.
c) To list the names of all students with their date of admission in ascending order.
d) To display student’s name, fee, age for male students only.
e) To count the number of students with Age>23.
(iii) Write SQL commands for the following queries on the basis of Club relation given below:
Coach-ID CoachName Age Sports date_of_app Pay Sex
1 Kukreja 35 Karate 27/03/1996 1000 M
2 Ravina 34 Karate 20/01/1998 1200 F
3 Karan 34 Squash 19/02/1998 2000 M
4 Tarun 33 Basketball 01/01/1998 1500 M
5 Zubin 36 Swimming 12/01/1998 750 M
6 Ketaki 36 Swimming 24/02/1998 800 F
7 Ankita 39 Squash 20/02/1998 2200 F
8 Zareen 37 Karate 22/02/1998 1100 F
9 Kush 41 Swimming 13/01/1998 900 M
10 Shailya 37 Basketball 19/02/1998 1700 M
a) To show all information about the swimming coaches in the club.
b) To list the names of all coaches with their date of appointment (date_of_app) in
descending order.
c) To display a report showing coach name, pay, age, and bonus (15% of pay) for all
coaches.
d) To insert a new row in the Club table with ANY relevant data:
e) Give the output of the following SQL statements:
i. Select COUNT(Distinct Sports) from Club;
ii. Select Min(Age) from Club where SEX = “F”;

(iv) Write SQL commands for (a) to (f) and write the outputs for (g) on the basis of tables
FURNITURE and ARRIVALS:

QB/XII/083/Easy Revision - 2021 11 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
FURNITURE
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 White lotus Double Bed 23/02/02 30000 25
2 Pink feather Baby cot 20/01/02 7000 20
3 Dolphin Baby cot 19/02/02 9500 20
4 Decent Office Table 01/01/02 25000 30
5 Comfort zone Double Bed 12/01/02 25000 25
6 Donald Baby cot 24/02/02 6500 15
7 Royal Finish Office Table 20/02/02 18000 30
8 Royal tiger Sofa 22/02/02 31000 30
9 Econo sitting Sofa 13/12/01 9500 25
10 Eating Paradise Dining Table 19/02/02 11500 25

ARRIVALS
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Wood Comfort Double Bed 23/03/03 25000 25
2 Old Fox Sofa 20/02/03 17000 20
3 Micky Baby cot 21/02/03 7500 15

a) To show all information about the Baby cots from the FURNITURE table.
b) To list the ITEMNAME which are priced at more than 15000 from the FURNITURE table.
c) To list ITEMNAME and TYPE of those items, in which date of stock is before 22/01/02
from the FURNITURE table in descending of ITEMNAME.
d) To display ITEMNAME and DATEOFSTOCK of those items, in which the discount
percentage is more than 25 from FURNITURE table.
e) To count the number of items, whose TYPE is "Sofa" from FURNITURE table.
f) To insert a new row in the ARRIVALS table with the following data:
14,“Valvet touch”, "Double bed", {25/03/03}, 25000,30
g) Give the output of following SQL stateme
Note: Outputs of the above mentioned queries should be based on original data
given in both the tables i.e., without considering the insertion done in (f) part of
this question.
(i) Select COUNT(distinct TYPE) from FURNITURE;
(ii) Select MAX(DISCOUNT) from FURNITURE,ARRIVALS;
(iii) Select AVG(DISCOUNT) from FURNITURE where TYPE="Baby cot";
(iv) Select SUM(Price) from FURNITURE where DATEOFSTOCK<{12/02/02};

(v) Consider the following tables GAMES and PLAYER. Write SQL commands for the statements
(a) to (d) and give outputs for SQL queries (E1) to (E4)
GAMES
GCode GameName Number PrizeMoney ScheduleDate
101 Carom Board 2 5000 23-Jan-2004
102 Badminton 2 12000 12-Dec-2003
103 Table Tennis 4 8000 14-Feb-2004
105 Chess 2 9000 01-Jan-2004
108 Lawn Tennis 4 25000 19-Mar-2004
PLAYER
PCode Name Gcode
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103

QB/XII/083/Easy Revision - 2021 12 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(a) To display the name of all Games with their Gcodes
(b) To display details of those games which are having PrizeMoney more than 7000.
(c) To display the content of the GAMES table in ascending order of ScheduleDate.
(d) To display sum of PrizeMoney for each of the Number of participation groupings (as
shown in column Number)
(e1) SELECT COUNT(DISTINCT Number) FROM GAMES;
(e2) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;
(e3) SELECT SUM(PrizeMoney) FROM GAMES;
(e4) SELECT DISTINCT Gcode FROM PLAYER;
(vi) Consider the following tables WORKER and PAYLEVEL and answer (a) and (b) parts of this
question: (CBSE 2011)
WORKER
ECODE NAME DESIG PLEVEL DOJ DOB
11 Radhey Shyam Supervisor P001 13-Sep-2004 23-Aug-1981
12 Chander Nath Operator P003 22-Feb-2010 12-Jul-1987
13 Fizza Operator P003 14-June-2009 14-Oct-1983
15 Ameen Ahmed Mechanic P002 21-Aug-2006 13-Mar-1984
18 Sanya Clerk P002 19-Dec-2005 09-June-1983
PAYLEVEL
PAYLEVEL PAY ALLOWANCE
P001 26000 12000
P002 22000 10000
P003 12000 6000
(a) Write SQL commands for the following statements:
(i) To display the details of all WORKERs in descending order of DOB.
(ii) To display NAME and DESIG of those WORKERs whose PLEVEL is either P001 or
P002.
(iii) To display the content of all the WORKERs table, whose DOB is in between ’19-
JAN-1984’ and ’18-JAN-1987’.
(iv) To add a new row with the following:
19, ‘Daya kishore’, ‘Operator’, ‘P003’, ’19-Jun-2008’, ’11-Jul-1984’
(b) Give the output of the following SQL queries:
(i) SELECT COUNT(PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL;
(ii) SELECT MAX(DOB), MIN(DOJ) FROM WORKER;
(iii) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE W.PLEVEL=P.PLEVEL
AND W.ECODE<13;
(iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL WHERE PLEVEL=’P003’;
(vii) Consider the following tables CABHUB and CUSTOMER and answer (a) and (b) parts of this
question: (CBSE 2012)
CABHUB
Vcode VehicleName Make Color Capacity Charges
100 Innova Toyota WHITE 7 15
102 SX4 Suzuki BLUE 4 14
104 C Class Mercedes RED 4 35
105 A-Star Suzuki WHITE 3 14
108 Indigo Tata SILVER 3 12
CUSTOMER
CCode CName VCode
1 Hemant Sahu 101
2 Raj Lal 108
3 Feroza Shah 105
4 Ketan Dhal 104

QB/XII/083/Easy Revision - 2021 13 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(a) Write SQL commands for the following statements:
1) To display the names of all white colored vehicles
2) To display name of vehicle, make and capacity of vehicles in ascending order of
their sitting capacity
3) To display the highest charges at which a vehicle can be hired from CABHUB.
4) To display the customer name and the corresponding name of the vehicle hired
by them.
(b) Give the output of the following SQL queries:
1) SELECT COUNT(DISTINCT Make) FROM CABHUB;
2) SELECT MAX(Charges), MIN(Charges) FROM CABHUB;
3) SELECT COUNT(*), Make FROM CABHUB;
4) SELECT VehicleName FROM CABHUB WHERE Capacity = 4;
(viii) Write SQL queries for (a) to (f) and write the outputs for the SQL queries mentioned shown
in (g1) to (g4) parts on the basis of tables ITEMS and TRADERS: (CBSE 2013)
ITEMS
CODE INAME QTY PRICE COMPANY TCODE
1001 DIGITAL PAD 12i 120 11000 XENITA T01
1006 LED SCREEN 40 70 38000 SANTORA T02
1004 CAR GPS SYSTEM 50 21500 GEOKNOW T01
1003 DIGITAL CAMERA 12X 160 8000 DIGICLICK T02
1005 PEN DRIVE 32GB 600 1200 STOREHOME T03

TRADERS
TCode TName CITY
T01 ELECTRONIC SALES MUMBAI
T03 BUSY STORE CORP DELHI
T02 DISP HOUSE INC CHENNAI
a) To display the details of all the items in the ascending order of item names (i.e.
INAME).
b) To display item name and price of all those items, whose price is in range of
10000 and 22000 (both values inclusive).
c) To display the number of items, which are traded by each trader. The expected
output of this query should be:
T01 2
T02 2
T03 1
d) To display the price, item name and quantity (i.e. qty) of those items which
have quantity more than 150.
e) To display the names of those traders, who are either from DELHI or from
MUMBAI.
f) To display the names of the companies and the names of the items in descending
order of company names.
g1 ) SELECT MAX(PRICE), MIN(PRICE) FROM ITEMS;
g2 ) SELECT PRICE*QTY AMOUNT FROM ITEMS WHERE CODE-1004;
g3 ) SELECT DISTINCT TCODE FROM ITEMS;
g4 ) SELECT INAME, TNAME FROM ITEMS I, TRADERS T WHERE I.TCODE=T.TCODE
AND QTY<100;

QB/XII/083/Easy Revision - 2021 14 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(ix) Answer the (a) and (b) on the basis of the following tables STORE and ITEM: (CBSE 2014)
STORE
SNo SName AREA
S01 ABC Computronics GK II
S02 All Infotech Media CP
S03 Tech Shoppe Nehru Place
S05 Hitech Tech Store SP
ITEM
INo IName Price SNo
T01 Mother Board 12000 S01
T02 Hard Disk 5000 S01
T03 Keyboard 500 S02
T04 Mouse 300 S01
T05 Mother Board 13000 S02
T06 Key Board 400 S03
T07 LCD 6000 S04
T08 LCD 5500 S05
T09 Mouse 350 S05
T10 Hard disk 4500 S03

(a) Write the SQL queries (1 to 4):


1) To display IName and Price of all the items in the ascending order of their Price.
2) To display the SNo and SName o all stores located in CP.
3) To display the minimum and maximum price of each IName from the table Item.
4) To display the IName, price of all items and their respective SName where they
are available.
(b) Write the output of the following SQL commands (1 to 4):
1) SELECT DISTINCT INAME FROM ITEM WHERE PRICE >= 5000;
2) SELECT AREA, COUNT(*) FROM STORE GROUP BY AREA;
3) SELECT COUNT(DISTINCT AREA) FROM STORE;
4) SELECT INAME, PRICE*0.05 DISCOUNT FROM ITEM WHERE SNO IN (‘S02’, ‘S03’);
(x) Consider the following DEPT and WORKER tables. Write SQL queries for (i) to (iv) and find
outputs for SQL queries (v) to (viii): (CBSE-Delhi 2015)
Table: DEPT
DCODE DEPARTMENT CITY
D01 MEDIA DELHI
D02 MARKETING DELHI
D03 INFRASTRUCTURE MUMBAI
D05 FINANCE KOLKATA
D04 HUMAN RESOURCE MUMBAI

Table: WORKER
WNO NAME DOJ DOB GENDER DCODE
1001 George K 2013-09-02 1991-09-01 MALE D01
1002 Ryma Sen 2012-12-11 1990-12-15 FEMALE D03
1003 Mohitesh 2013-02-03 1987-09-04 MALE D05
1007 Anil Jha 2014-01-17 1984-10-19 MALE D04
1004 Manila Sahai 2012-12-09 1986-11-14 FEMALE D01
1005 R SAHAY 2013-11-18 1987-03-31 MALE D02
1006 Jaya Priya 2014-06-09 1985-06-23 FEMALE D05

Note: DOJ refers to date of joining and DOB refers to date of Birth of workers.

QB/XII/083/Easy Revision - 2021 15 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(i) To display Wno, Name, Gender from the table WORKER in descending order of
Wno.
(ii) To display the Name of all the FEMALE workers from the table WORKER.
(iii) To display the Wno and Name of those workers from the table WORKER who
are born between ‘1987-01-01’ and ‘1991-12-01’.
(iv) To count and display MALE workers who have joined after ‘1986-01-01’.
(v) SELECT COUNT(*), DCODE FROM WORKER GROUP BY DCODE HAVING
COUNT(*)>1;
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
(vii) SELECT NAME, DEPARTMENT, CITY FROM WORKER W,DEPT D WHERE
W.DCODE=D.DCODE AND WNO<1003;
(viii) SELECT MAX(DOJ), MIN(DOB) FROM WORKER;

(xi) Consider the following DEPT and EMPLOYEE tables. Write SQL queries for (i) to (iv) and
find outputs for SQL queries (v) to (viii). (CBSE-Outside Delhi 2015)
Table: DEPT
DCODE DEPARTMENT LOCATION
D01 INFRASTRUCTURE DELHI
D02 MARKETING DELHI
D03 MEDIA MUMBAI
D05 FINANCE KOLKATA
D04 HUMAN RESOURCE MUMBAI

Table: EMPLOYEE
ENO NAME DOJ DOB GENDER DCODE
1001 George K 20130902 19910901 MALE D01
1002 Ryma Sen 20121211 19901215 FEMALE D03
1003 Mohitesh 20130203 19870904 MALE D05
1007 Anil Jha 20140117 19841019 MALE D04
1004 Manila Sahai 20121209 19861114 FEMALE D01
1005 R SAHAY 20131118 19870331 MALE D02
1006 Jaya Priya 20140609 19850623 FEMALE D05

Note: DOJ refers to date of joining and DOB refers to date of Birth of employees.
(i) To display Eno, Name, Gender from the table EMPLOYEE in ascending order of Eno.
(ii) To display the Name of all the MALE employees from the table EMPLOYEE.
(iii) To display the Eno and Name of those employees from the table EMPLOYEE who
are born between '1987‐01‐01' and '1991‐12‐01'.
(iv) To count and display FEMALE employees who have joined after '1986‐01‐01'.
(v) SELECT COUNT(*),DCODE FROM EMPLOYEE
GROUP BY DCODE HAVING COUNT(*)>1;
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
(vii) SELECT NAME, DEPARTMENT FROM EMPLOYEE E, DEPT
D WHERE E.DCODE=D.DCODE AND EN0<1003;
(viii) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;

(xii) Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on
the tables. (CBSE- Delhi 2016)
Table: VEHICLE
Code VTYPE PERKM
101 VOLVO BUS 160
102 AC DELUXE BUS 150
103 ORDINARY BUS 90
105 SUV 40
104 CAR 20

Note:
• PERKM is Freight Charges per kilometer
• VTYPE is Vehicle Type

QB/XII/083/Easy Revision - 2021 16 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
Table: TRAVEL
NO NAME TDATE KM CODE NOP
101 Janish Kin 2015-11-13 200 101 32
103 Vedika sahai 2016-04-21 100 103 45
105 Tarun Ram 2016-03-23 350 102 42
102 John Fen 2016-02-13 90 102 40
107 Ahmed Khan 2015-01-10 75 104 2
104 Raveena 2015-05-28 80 105 4
106 Kripal Anya 2016-02-06 200 101 25

Note :
• NO is Traveller Number
• KM is Kilometer travelled
• NOP is number of travellers travelled in vehicle
• TDATE is Travel Date
(i) To display NO, NAME, TDATE from the table TRAVEL in descending order of NO.
(ii) To display the NAME of all the travellers from the table TRAVEL who are travelling
by vehicle with code 101 or 102.
(iii) To display the NO and NAME of those travellers from the table TRAVEL who
travelled between ‘2015-12-31’ and ‘2015-04-01’.
(iv) To display all the details from table TRAVEL for the travellers, who have travelled
distance more than 100 KM in ascending order of NOP.
(v) SELECT COUNT (*), CODE FROM TRAVEL GROUP BY CODE HAVING
COUNT(*)>1;
(vi) SELECT DISTINCT CODE FROM TRAVEL;
(vii) SELECT A.CODE,NAME,VTYPE FROM TRAVEL A,VEHICLE B WHERE
A.CODE=B.CODE AND KM<90;
(viii) SELECT NAME,KM*PERKM FROM TRAVEL A, VEHICLE B WHERE
A.CODE=B.CODE AND A.CODE=‘105’;

(xiii) Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on
the tables. (CBSE- Outside Delhi 2016)

Table: VEHICLE
VCODE VEHICLETYPE PERKM
V01 VOLVO BUS 150
V02 AC DELUXE BUS 125
V03 ORDINARY BUS 80
V05 SUV 30
V04 CAR 18
Note:
• PERKM is Freight Charges per kilometer

Table: TRAVEL
CNO CNAME TRAVELDATE KM VCODE NOP
101 K.Niwal 2015-12-13 200 V01 32
103 Fredrick Sym 2016-03-21 120 V03 45
105 Hitesh Jain 2016-04-23 450 V02 42
102 Ravi anish 2016-01-13 80 V02 40
107 John Malina 2015-02-10 65 V04 2
104 Sahanubhuti 2016-01-28 90 V05 4
106 Ramesh jaya 2016-04-06 100 V01 25

Note :
• KM is Kilometer travelled
• NOP is number of travellers travelled in vehicle
• TDATE is Travel Date
(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending
order of CNO.

QB/XII/083/Easy Revision - 2021 17 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(ii) To display the CNAME of all the customers from the table TRAVEL who are
travelling by vehicle with code V01 or V02.
(iii) To display the CNO and CNAME of those customers from the table TRAVEL who
travelled between ‘2015-12-31’ and ‘2015-05-01’.
(iv) To display all the details from table TRAVEL for the customers, who have travelled
distance more than 120 KM in ascending order of NOP.
(v) SELECT COUNT (*), VCODE FROM TRAVEL GROUP BY V CODE
HAVING COUNT(*)>1;
(vi) SELECT DISTINCT VCODE FROM TRAVEL;
(vii) SELECT A.VCODE,CNAME,VEHICLETYPE FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND KM<90;
(viii) SELECT CNAME,KM*PERKM FROM TRAVEL A, VEHICLE B WHERE
A.VCODE=B.VCODE AND A.VCODE=‘V05’;

Computer Networks – Descriptive questions


1. What is a computer network?
2. Expand the terms: HTTP, HTTPS, SSH, SCP, POP, IMAP, SMTP, FTP, VoIP, URL, GPRS
3. What is VoIP? (CBSE 2011)
4. What, out of the following, will you use to have an audio-visual chat with an expert sitting in a
faraway place to fix-up a technical issue? (CBSE 2012)
Email, VoIP, FTP
5. Give one suitable example of each – URL and Domain Name. (CBSE 2012)
6. What is the difference between domain name and IP address? (CBSE 2013)
7. Write two advantages of using an optical fiber cable over an Ethernet cable to connect two service
stations, which are 190m away from each other. (CBSE 2013)
8. Write one characteristic each for 2G and 3G Mobile technologies. (CBSE 2014)
9. Which type of network (out of LAN, PAN, MAN) is formed when you connect two mobiles using
Bluetooth to transfer a picture file? (CBSE 2014)
10. Write any two important characteristics of Cloud Computing. (CBSE 2014)
11. Differentiate between ftp and http. (CBSE 2015)
12. Out of the following, which is the fastest (i) wired and (ii) wireless medium of communication?
(CBSE-Delhi, Outside Delhi 2015)
Infrared, Coaxial Cable, Ethernet Cable, Microwave, Optical Fiber
13. Give two examples of PAN and LAN type of networks. (CBSE- Delhi 2016)
14. Which protocol helps us to browse through web pages using internet browsers? Name any one
internet browser. (CBSE- Delhi 2016)
15. Write two advantages of 4G over 3G Mobile Telecommunication Technologies in terms of speed
and services. (CBSE- Delhi 2016)
16. Differentiate between PAN and LAN types of networks. (CBSE-Outside Delhi 2016)
17. Which protocol helps us to transfer files to and from a remote computer?
(CBSE-Outside Delhi 2016)
18. Write two advantages of 3G over 2G Mobile Telecommunication Technologies in terms of speed
and services. (CBSE-Outside Delhi 2016)
19. What is attenuation?
20. Differentiate between IPv4 and IPv6 addresses with an example of each.
21. Differentiate between physical address and logical address of a node in a computer network.
22. Differentiate between Guided media and Unguided media with an example of each.
23. Explain the terms: (i) remote login (ii) remote desktop
24. What is Application layer in a computer network?
25. Explain the terms: (i) Wi-Fi (ii) Access Point?
26. Expand and explain the term DNS.
27. Differentiate between Bus topology and Star topology.
28. Mention any two advantages of using optical fibre over other guided media.
29. What is video conferencing?
30. Define the terms Worm and Trojan Horse as a malware.
31. What is a cookie?
32. Explain the terms Packet Switching and Circuit Switching.
33. Define the following terms:
(a) Digital property, (b) Intellectual property (c) Intellectual Property rights

QB/XII/083/Easy Revision - 2021 18 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
34. Define the following terms:
(a) plagiarism (b) scam (c) identity theft (d) phishing (e) Illegal downloads (f) child pornography
(g) spam mail
35. What is cyber forensics?
36. What is IT Act 2000?
37. Explain the following terms (licenses):
(a) Creative Commons (b) GPL (c) Apache
38. Categorise the following cyber-crimes:
(i) Using someone else’s social media account to post something.
(ii) Unauthorised use of someone else’s credit card
(iii) Sending unsolicited commercial bulk mails
(iv) Online access to a bank account for unauthorized transactions
(v) Modifying a company’s data with unauthorized access
39. Out of the following, which all comes under cyber crime? (CBSE 2015)
(i) Stealing away a brand new computer from a showroom.
(ii) Getting in someone’s social networking account without his consent and posting pictures
on his behalf to harass him.
(iii) Secretly copying files from server of a call center and selling it to the other organization.
(iv) Viewing sites on an internet browser.

40. Which of the following crime(s) is/are covered under cybercrime? (CBSE 2013)
(i) Stealing brand new hard disk from a shop
(ii) Getting into unknown person’s social networking account and start messaging on his
behalf.
(iii) Copying some important data from a computer without taking permission from the owner
of the data.

Computer Networks - Network Setup


(i) Quick Learn University is setting up its academic blocks at Prayag nagar and is planning to set up
a network. The University has 3 academic blocks and one Human Resource Center as shown in
the diagram below: (CBSE 2011)

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 center 105m
Business Block to technology Block 30m
Business Block to HR Center 35m
Technology block to HR center 15m
Number of computers in each of the blocks/Center is as follows:
Law Block 15
Technology Block 40
HR center 115
Business Block 25
b) Suggest the most suitable place (i.e., Block/Center) to install the server of this University with a
suitable reason.
c) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
d) Which device will you suggest to be placed/installed in each of these blocks/centers to efficiently
connect all the computers within these blocks/centers.

QB/XII/083/Easy Revision - 2021 19 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
e) The university is planning to connect its admission office in the closest big city, which is more
than 250km from university. Which type of network out of LAN, MAN, or WAN will be formed?
Justify your answer.

(ii) Granuda Consultants are setting up a secured network for their office campus at Faridabad for their
day to day office and web based activities. They are planning to have connectivity between 3
buildings and the head office situated in Kolkata. Answer the questions (a) to (d) after going through
the building positions in the campus and other details, which are given below: (CBSE 2012)

Distances between various buildings:


Building “RAVI” to Building “JAMUNA” 120m
Building “RAVI” to Building “GANGA” 50m
Building “GANGA” to Building “JAMUNA” 65m
Faridabad Campus to Head Office 1460km

Number of computers:
Building “RAVI” 25
Building “JAMUNA” 150
Building “GANGA” 51
Head Office 10

a) Suggest the most suitable place (i.e. block) to house the server of this organization. Also give
a reason to justify your suggested location.
b) Suggest a cable layout of connections between the buildings inside the campus.
c) Suggest the placement of the following devices with justification:
(i) Switch
(ii) Repeater
d) The organization is planning to provide a high speed link with its head office situated in
KOLKATA using a wired connection. Which of the following cable will be most suitable for this
job?
(i) Optical Fiber
(ii) Co-axial cable
(iii) Ethernet cable

(iii) Expertia Professional Global (EPG) is an online corporate training provider company for IT related
courses. The company is setting up their new campus in Mumbai. You as a network expert have
to study the physical locations of various buildings and the number of computers to be installed. In
the planning phase, provide the best possible answers for the queries (a) to (d) raised by them.
(CBSE 2013)

QB/XII/083/Easy Revision - 2021 20 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

Building to Building distances (in Mtrs.)


FROM To Distance
Administrative Building Finance Building 60
Administrative Building Faculty Studio building 120
Finance Building Faculty Studio building 70

Number of computers in each of the blocks/Center is as follows:


Administrative Building 20
Finance Building 40
Faculty Studio building 120

a) Suggest the most appropriate building, where EPG should plan to install the server.
b) Suggest the most appropriate building to building cable layout to connect all three buildings
for efficient communication.
c) Which type of network out of the following is formed by connecting the computers of these
three buildings?
LAN, MAN, WAN
d) Which wireless channel out of the following should be opted by EPG to connect to students
of all over the world?
Infrared, Microwave, Satellite

(iv) Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to
set up their new offices in India with its hub at Hyderabad. As a network adviser, you have to
understand their requirement and suggest them the best available solutions. Their queries are
mentioned (a) to (d) below. (CBSE 2014)

Block to Block distances (in Mtrs.)


FROM To Distance
Human resource Conference 110
Human resource Finance 40
Conference Finance 80

Number of computers in each of the blocks/Center is as follows:


Human resource 25
Finance 120
Conference 90

QB/XII/083/Easy Revision - 2021 21 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
a) What will be the most appropriate block, where TTC should plan to install the server?
b) Draw a block to block cable layout to connect all the buildings in the most appropriate manner for
efficient communication.
c) What will be the best possible connectivity out of the following, you will suggest to connect the new
setup of offices in Bangalore with its London based office?
Satellite Link, Infrared, Ethernet cable
d) Which of the following devices will be suggested by you to connect each computer in each of the
buildings.
Switch, modem, Gateway

(v) Perfect Edu Services Ltd. is an educational organization. It is planning to setup its India campus at
Chennai with its head office at Delhi. The Chennai campus has 4 main buildings – ADMIN,
ENGINEERING, BUSINESS and MEDIA (CBSE 2015)

Shortest distances between various buildings:


ADMIN to ENGINEERING 55 m
ADMIN to BUSINESS 90 m
ADMIN to MEDIA 50 m
ENGINEERING to BUSINESS 55 m
ENGINEERING to MEDIA 50 m
BUSINESS to MEDIA 45 m
DELHI Head Office to CHENNAI Campus 2175 km
Number of Computers installed at various buildings are as follows:
ADMIN 110
ENGINEERING 75
BUSINESS 40
MEDIA 12
DELHI Head Office 20
a) Suggest the most appropriate location of the server inside the CHENNAI campus (out of
the 4 buildings), to get the best connectivity for maximum no. of computers. Justify your
answer.
b) Suggest and draw the cable layout to efficiently connect various buildings within the
CHENNAI campus for connecting the computers.
c) Which hardware device will you suggest to be procured by the company to be installed to
protect and control the internet uses within the campus?
d) Which of the following will you suggest to establish the online face-to-face communication
between the people in the Admin Office of CHENNAI campus and DELHI Head Office?
(a) Cable TV
(b) Email
(c) Video Conferencing
(d) Text Chat

(vi) Xcelencia Edu Services Ltd. is an educational organization. It is planning to set up its India campus
at Hyderabad with its head office at Delhi. The Hyderabad campus has 4 main buildings:
ADMIN, SCIENCE, BUSINESS and MEDIA. (CBSE-Outside Delhi 2015)

You as a network expert have to suggest the best network related solutions for their problems
raised in (a) to (d), keeping in mind the distances between the buildings and other given
parameters.

QB/XII/083/Easy Revision - 2021 22 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

Shortest Distances between various buildings:


ADMIN to SCIENCE 65M
ADMIN to BUSINESS 100m
ADMIN to ARTS 60M
SCIENCE to BUSINESS 75M
SCIENCE to ARTS 60M
BUSINESS to ARTS 50M
DELHI Head Office to HYDERABAD Campus 1600KM

Number of Computers installed at various building are as follows:


ADMIN 100
SCIENCE 85
BUSINESS 40
ARTS 12
DELHI Head Office 20

a) Suggest the most appropriate location of the server inside the HYDERABAD campus (out
of the 4 buildings), to get the best connectivity for maximum no. of computers. Justify your
answer.
b) Suggest and draw the cable layout to efficiently connect various buildings 'within the
HYDERABAD campus for connecting the computers.
c) Which hardware device will you suggest to be procured by the company to be installed to
protect and control the internet uses within the campus?
d) Which of the following will you suggest to establish the online face‐to‐face communication
between the people in the Admin Office of HYDERABAD campus and DELHI Head Office?
(a) E‐mail (b) Text Chat (c) Video Conferencing (d) Cable TV

(vii) Uplifting Skills Hub India is a knowledge and skill community which has an aim to uplift the standard
of knowledge and skills in the society. It is planning to setup its training centers in multiple towns
and villages pan 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 follows:

As a network consultant, you have to suggest the best network related solutions for their

issues/problems raised in (a) to (d) keeping in mind the distances between various locations and
other given parameters.
Shortest distances between various locations:

QB/XII/083/Easy Revision - 2021 23 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

VILLAGE 1 to B_TOWN 2 KM
VILLAGE 2 to B_TOWN 1.0 KM
VILLAGE 3 to B_TOWN 1.5 KM
VILLAGE 1 to VILLAGE 2 3.5 KM
VILLAGE 1 to VILLAGE 3 4.5 KM
VILLAGE 2 to VILLAGE 3 2.5 KM
A_CITY Head Office to B_HUB 25 KM

Number of Computers installed at various locations are as follows:


B_TOWN 120
VILLAGE 1 15
VILLAGE 2 10
VLLAGE 3 15
A_CITY OFFICE 6

Note :
• In Villages, there are community centers, in which one room has been given as training
center to this organization to install computers.
• The organization has got financial support from the government and top IT companies.

a) Suggest the most appropriate location of the SERVER in the B_HUB (out of the 4
locations), to get the best and effective connectivity. Justify your answer.
b) Suggest the best wired medium and draw the cable layout (location to location) to
efficiently connect various locations within the B_HUB.
c) Which hardware device will you suggest to connect all the computers within each
location of B_HUB?
d) Which service/protocol will be most helpful to conduct live interactions of Experts
from Head Office and people at all locations of B_HUB?

(viii) Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and knowledge
in the society. It is planning to setup its training centers in multiple towns and villages pan 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 follows.
As a network consultant, you have to suggest the best network related solutions for their
issues/problems raised in (a) to (d), keeping in mind the distances between various locations and
other given parameters.

Shortest distance between various locations:

Number of computers installed at various locations are as follows:

QB/XII/083/Easy Revision - 2021 24 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

Note:
• In Villages, there are community centers, in which one room has been given as training center to
this organization to install computers.
• The organization has got financial support from the government and top IT companies.

a) 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.
b) Suggest the best wired medium and draw the cable layout (location to location) to efficiently
connect various locations within the YHUB.
c) Which hardware device will you suggest to connect all the computers within each location of
YHUB?
d) Which service/protocol will be most helpful to conduct live interactions of Experts from Head
Office and people at YHUB locations?

Society, Law, and Ethics


1. Define the following terms:
(a) Digital property, (b) Intellectual property (c) Intellectual Property rights
2. Define the following terms:
(a) plagiarism (b) scam (c) identity theft (d) phishing (e) Illegal downloads (f) child pornography
(g) spam mail
3. What is cyber forensics?
4. What is IT Act 2000?
5. Explain the following terms (licenses):
(a) Creative Commons (b) GPL (c) Apache
6. What is meant by privacy of data? Why is data privacy important?
7. Categorise the following cyber-crimes:
(i) Using someone else’s social media account to post something.
(ii) Unauthorised use of someone else’s credit card
(iii) Sending unsolicited commercial bulk mails
(iv) Online access to a bank account for unauthorized transactions
(v) Modifying a company’s data with unauthorized access
8. Out of the following, which all comes under cyber crime? (CBSE 2015)
(v) Stealing away a brand new computer from a showroom.
(vi) Getting in someone’s social networking account without his consent and posting pictures
on his behalf to harass him.
(vii) Secretly copying files from server of a call center and selling it to the other organization.
(viii) Viewing sites on an internet browser.

9. Which of the following crime(s) is/are covered under cybercrime? (CBSE 2013)
(iv) Stealing brand new hard disk from a shop
(v) Getting into unknown person’s social networking account and start messaging on his
behalf.
(vi) Copying some important data from a computer without taking permission from the owner
of the data.

QB/XII/083/Easy Revision - 2021 25 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

ANSWERS
Descriptive Questions:
1. A function is a named group of statements which get executed when the function is invoked.
2.
Actual Parameters Formal Parameter
Parameter used in function call. Parameter used in function definition.
Can be an identifier, a literal, or any other valid Has to be an identifier only.
expression.
Example:
def func(a,b):
print(a,b)
r=1
func(3,r*2)

In the above code, 3 and r*2 in the function call are actual parameters, whereas a and b in
the function definition are formal parameters.
3.
Value Parameter Reference Parameter
It is a copy of the corresponding actual It is an alias of the corresponding reference
parameter. parameter.
Any change in a value parameter does not Any change in a reference parameter is
affect the corresponding actual parameter. reflected on the corresponding actual
parameter too.
All immutable data objects are accepted as All mutable data objects are accepted as
value parameters in a function. reference parameters in a function.
Example:
def func(a,b):
a[b]+=1
b+=1
arr=[1,2,3,4]
n=2
func(arr,n)
print(arr,n)

In the above code arr is passed to a as a reference parameter, and n is passed to b as a


value parameter. After the function call, the value of arr is changed, whereas value of n
remains the same. The output of the above code is: [1, 2, 4, 4] 2
4. Scope of a variable refers to the part of the code (program) in which it can be used.
5.
Local variable Global variable
Defined inside a function without using the Defined outside any function, or inside a
keyword ‘global’. function using the keyword ‘global’.
Can be used only in the function in which it is Can be used anywhere, after its
used. declaration, in a program.
Example:
def func():
global p,q
a=p; q=a; p=a+q
print(a,p,q)
p=3
func()
print(p,q)
In the above code p and q are global variables, whereas a is a local variable. The output
produced by the above code is:
3 6 3
6 3
6. Keyword ‘global’ is used in a function to
(i) Specify the global variable(s) which need to be updated in the function
(ii) Declare global variable(s) inside a function.

QB/XII/083/Easy Revision - 2021 26 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
7. Yes, a function can have a local variable with the same name as that of a global variable in the script.
Yes, it is possible to access global variable with the same name in that function using the in-built
function globals().
8. return statement is used to return a value from a function. A fuction returns None in the following three
cases:
(i) The function has no return statement
(ii) The function has blank return statement
(ii) The function explicitly returns None by return statement.
9. A mutable data object is always passed as a reference parameter to a function. It means that whatever
change is made to the corresponding formal parameter, it will be reflected on the passed data object
too.
An immutable data object is always passed as a value parameter to a function. It means that any
change made to the corresponding formal parameter has no effect on the passed data object.
10. A function header is the first statement of a function definition. It starts with key word def, followed by
function name and an optional list of parameters within parentheses, and is terminated by a colon (:).
Example:
def func(a,b): #function header
print(a,b)
11.
def func(x): ->Function header, formal parameter - b
global b
y=b+2
b*=y function body
y+=x+b
print(x,y,b)
x,b=5,10
func(x) -> Function Call, Actual parameter - x
print(func(x)) -> Function Call, Actual parameter - x
12. A module is a python script (a .py file) containing one or more of the following components: declarations
(classes, objects, variables etc.), function definitions, function calls, independentt statements
(executable code outside a function).
13. A package is a folder containing one or more modules and a file __init__.py. The presence of the file
__init__.py, even if empty, lets python treat a folder as a package to be imported in other modules, if
required. Without __init__.py, a folder is just a normal folder and cannot be treated as a package.
14.
(i) From myModule import alpha
(ii) From Computer import comp1(), comp2()
(iii) From lib import pkg
(iv) From HR import Salary
(v) Import Trigonometry
15. A file is a named collection of data stored on a secondary storage device.
16. Files are needed for permanent storage of data.
17. Text file and Binary file.
18.
Text File Binary File
A text file can be created using any text editor or A binary file can be created using only a
a computer program. computer program.
A text file can be opened meaningfully using any A binary file can be read meaningfully only
text editor or a computer program. by a computer program.

19. Writing data in the file, Reading data from the file.
20. It is a small memory space allocated to a file object. All the transfer of data between the program and
the file (on secondary storage device) happens through buffer only. Each file object is allocated its own
separate buffer.
21. A file can be opened using the open() function.
22.
File opening If the file already exists If the file does not exist
mode
‘r’ File is opened in read mode. FileNotFoundError is raised.
‘r+’ File is opened in read-write mode FileNotFoundError is raised.
with file pointer at 0.
‘w’ File contents are deleted and file is File is created and opened in write mode.
opened in write mode.

QB/XII/083/Easy Revision - 2021 27 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
‘w+’ File contents are deleted and file is File is created and opened in read-write
opened in read-write mode. mode.
‘a’ File is opened in append mode. File is created and opened in append mode.
‘a+’ File is opened in read-append File is created and opened in read-append
mode. mode.
‘x’ FileExistsError is raised. File is created and opened in write mode.
‘x+’ FileExistsError is raised. File is created and opened in read-append
mode.

23.
Write mode Append mode
Data can be written anywhere in the file. Data can be written only at the end of the
existing data in the file.
File pointer can be adjusted using seek() File pointer cannot be adjusted.
Already existing data, if any, is deleted from the Already existing data, if any, is not deleted from
file. the file.

24. Write() – writes a string in the file.


Writelines() – writes a list of strings in the file.

25. Read() – reads the data from the file as a string.


Readline() – reads one line of data from the file, as a string.
Readlines() – reads the entire file content as a list of strings.
26. It is important to close a file to:
a. Free the file handle allocated to the file, so that it can be used for some other file.
b. To flush the buffer into the file if the file was opened in write or append mode.
27.
(i) append (ii) read (iii) write (iv) append
28.
seek() tell()
Sets the file pointer. Returns the value of file pointer.
Takes one integer parameter. Does not take any parameter.
29.
Text file Binary file
Contains lines of text, where each line is Contains data in the form of sequence of bytes.
terminated by an EOL charater. There is no concept of lines or EOL character.
Can be created and meaningfully read using any Can be created through a program, and
text editor or a program. meaningfully read only through some specific
programs or application(s).
30. rename() function is used to rename a file. remove() function is used to delete a file. These function
are available in the os module.
31. stdin, stdout, stderr
32. Pickling” is the process whereby a Python object hierarchy is converted into a byte stream,
and “unpickling” is the inverse operation, whereby a byte stream (from a binary file or bytes-like object)
is converted back into an object hierarchy.
33. A stack is a linear data structure which is used for LIFO type of data processing.
34. TOP – It is the open end of a stack from where all insertions in the stack and deletions from the stack
are performed.
PUSH – The insertion operation in a stack is known as PUSH.
POP – The deletion operation from a stack is called POP.
35. A stack can be implemented in Python using a list.
36. Overflow – It is the condition when we try PUSH an element in an empty stack.
Underflow – It is the condition when we try to POP an element from an empty stack.
37. A csv file is a text file in which each line represents a record, and fields within a record are separated
by commas. The commas are not a part of data.
In a text file, there is no concept of records and fields. Each character in a text file is part of data. All
csv files are text files, but all text files are not csv files.
38. A connection is an object which connects a Python program to a database. A cursor is an object which
is used to execute SQL queries over a connection.
39. fetchone() retrieves the next row of a query result set and returns it as a tuple. It returns None if there
are no more rows to be fetched.

QB/XII/083/Easy Revision - 2021 28 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
40. fetchall() fetches all (or all remaining) rows of a query result set and returns a list of tuples. If no more
rows are available, it returns an empty list.
41. fetchmany() fetches a specified number of rows of a query result set and returns a list of tuples. If no
more rows are available, it returns an empty list.
42. While, Float, new, Amount2, _Counter
43. For, INT, NeW, delete, name1
44. Pr*Qty, float, Address One, in
45. Total Tax, S.I.

Finding the Errors:


1.
(i) def f1(a,b):
a+=b
b*=a
print(a,b)
x,b=5,10 #or any other numeric value for b
f1(x,b) #or any other numeric expression as second argument.

(ii) def f2(x):


global b
x+=b
b*=y
print(x,b,sep='*')
x,b=5,10
f2(b)

(iii) def f3(b,a=1):


global x,y
x=a+b
a,y=a+x,a*x
print(a,b,x,y)
f3(5,10)
print(f3(5))
2. The given code will raise an exception because the code is trying to write in a file open in read
mode.

Finding the Output:


1.
(i) 15 150
5 10
(ii) 15 35 100
5 100
(iii) 20 10 15 75
165 15 90 6750
None
(iv) 111**II
555**5KKK
(v) abcba
acabba
(vi) 14 8 22
67 45 111
(vii) r#TI#N#l

2. 9

QB/XII/083/Easy Revision - 2021 29 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
Differentiate between:
1. Import random and from random import random
Import random From random import random
Imports the complete random module Imports only the function random() from the
random module
Any function from the random module can be Only the imported function can be used in the
used in the code code.
Function call needs to be qualified by prefixing No prefix is needed with the function call
module name random with the function call.
Example: random.random() Example: random()

2. Import math and from math import sqrt


Import math From math import sqrt
Imports the complete math module Imports only the function sqrt() from the math
module
Any function from the math module can be used Only the imported function can be used in the
in the code code.
Function call needs to be qualified by prefixing No prefix is needed with the function call
module name random with the function call.
Example: math.sqrt() Example: sqrt()

3. random.randint() and randint()


random.randint() randint()
Imports the complete math module Imports only the function sqrt() from the math
module
Any function from the math module can be used Only the imported function can be used in the
in the code code.
Function call needs to be qualified by prefixing No prefix is needed with the function call
module name random with the function call.
Example: math.sqrt() Example: sqrt()

Writing code:
1. def high(a,b,c):
if a>=b and a>=c:
return a
if b>=c and b>=a:
return b
if c>=a and c>=b:
return c
2. def rev_str(s):
s1=''
for ch in s:
s1=ch+s1
return s1

3. def sort_words(s):
s=s.split(',')
s.sort()
s=','.join(s)
return s

Text File Operations


1. 4
2. def count_spaces():
with open("para.txt") as f:
data=f.read()
c=data.count(' ')
return(c)

QB/XII/083/Easy Revision - 2021 30 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
3. print(open("abc.txt").read())
4. def vowelwords():
f1=open("text1.txt")
f2=open("text2.txt",'w')
for line in f1:
line=line.split()
for word in line:
if word[0] not in "AEIOU":
f2.write(word+" ")
f2.write("\n")
f1.close()
f2.close()
5. def count_end():
c=0
with open("story.txt") as f:
for line in f:
line=line.strip()
if line !="" and line[-1] in "aeiouAEIOU":
c+=1
print(c)
6. def count_words_A():
c=0
with open("Lines.txt") as f:
for line in f:
line=line.split()
for word in line:
if word[0] in "aA":
c+=1
print(c)

7. def last_three():
f=open("story.txt")
data=f.read()
data=data.strip()
print(data[-3:])
f.close()

8. def copy():
f1=open("FAIPS.txt")
f2=open("DPS.txt",'w')
data=f1.read()
for word in data:
if word[0].isupper():
f2.write(word+" ")
f1.close()
f2.close()

9. def show(n):
f=open("MIRA.TXT")
data=f.read()
f.close()
if len(data)<n:
print("Inavid n")
else: print(data[n-1])

QB/XII/083/Easy Revision - 2021 31 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
10. def Me_My():
f=open("DIARY.TXT")
data=f.read()
f.close()
data=data.upper()
c=data.count("ME")+data.count("MY")
print("Count of Me/My in file:",c)

11. def places():


with open("places.txt") as f:
for line in f:
if line[0] in "pPsS":
print(line)

12. def CountHisHer():


f=open("gender.TXT")
data=f.read()
f.close()
data=data.upper()
data=data.split()
his=data.count("HIS")
her=data.count("HER")
print("Count of His:",his)
print("Count of Her:",her)

13. def EUcount():


e=u=0
with open("IMP.TXT") as f:
ch=f.read(1)
while (ch):
if ch in "eE":
e+=1
elif ch in "uU":
u+=1
ch=f.read(1)
print("E:",e)
print("U:",u)

14. def SUCCESS():


f=open("STORY.TXT")
data=f.read()
f.close()
data=data.upper()
data=data.split()
c=data.count("SUCCESS")\
+data.count("SUCCESS,")\
+data.count("SUCCESS.")\
+data.count("SUCCESS;")\
+data.count("SUCCESS:")
print(c)

15. def TOWER():


f=open("writeup.TXT")
data=f.read()

QB/XII/083/Easy Revision - 2021 32 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
f.close()
data=data.upper()
data=data.split()
c=data.count("TOWER")\
+data.count("TOWER,")\
+data.count("TOWER.")\
+data.count("TOWER;")\
+data.count("TOWER:")
print(c)

16. def WORD4CHAR():


f=open("fun.TXT")
data=f.read()
f.close()
data=data.split()
for word in data:
if word[-1] in ".,:;":
word=word[:-1]
if len(word)==4:
print(word,end=' ')
17. def DISP3CHAR():
f=open("fun.TXT")
data=f.read()
f.close()
data=data.split()
for word in data:
if word[-1] in ".,:;":
word=word[:-1]
if len(word)==3:
print(word,end=' ')

18. def copyFile():


sf=input("Enter source file name: ")
tf=input("Enter target file name: ")
f1=open(sf)
f2=open(tf,'w')
data=f1.read()
f2.write(data)
f1.close()
f2.close()

19. def f1(sfn, tfn):


sf=open(sfn)
tf=open(tfn,'w')
data=sf.read()
while ' ' in data:
data=data.replace(' ',' ')
tf.write(data)
sf.close()
tf.close()

20. def write_file():


import sys
print("Enter a multi-line string,press ^D \
in the beginning of a line to terminate: ")
a=sys.stdin.read()
open('story1.txt','w').write(a)

QB/XII/083/Easy Revision - 2021 33 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
21. def read_last_line(fn):
f=open(fn,'r')
data=f.readlines()
print(data[-1])
f.close()

22. def indexing(fn,indexFile):


import pickle
f=open(fn,'r')
data=f.readlines()
index={}
i=0
for line in data:
i+=1
for word in line.split():
if word not in index:
index[word]=[i]
elif i not in index[word]:
index[word]+=[i]
f.close()
f=open(indexFile,'wb')
pickle.dump(index,f)
f.close()

23. def readAndCount():


f=open('BOOKS.TXT')
l=u=d=0
data=f.read()
f.close()
print(data)
for ch in data:
if ch.islower():
l+=1
elif ch.isupper():
u+=1
elif ch.isdigit():
d+=1
print('Lowercase characters:',l)
print('Uppercase characters:',u)
print('Digits:',d)
24. def fileSize():
fn=input("Enter file name: ")
f=open(fn)
data=f.read()
data=data.replace(' ','')
data=data.replace('\n','')
data=data.replace('\t','')
print(len(data))

Binary File Operations


1. def update_pro():
import pickle,os
temp=open("file.tmp",'wb')
with open("PRODUCT.DAT",'rb') as f:
pc=input("Enter product code: ")
st=int(input("Enter stock: "))
found=0
while(1):
try:
rec=pickle.load(f)
if rec['prod_code']==pc:
rec['stock']=st

QB/XII/083/Easy Revision - 2021 34 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
found=1
pickle.dump(rec,temp)
except:
break
temp.close()
if found==0:
print("Record not found")
else:
os.remove("product.dat")
os.rename("file.tmp","product.dat")
print("Record updated")
2. def show_percentage():
found=0
with open("student.dat",'rb') as f:
while(1):
try:
rec=pickle.load(f)
if rec[2]>75:
print(rec)
found=1
except:
break
if found==0:
print("No such record found")
3. def show_vehicle():
c=0
with open("speed.dat",'rb') as f:
while(1):
try:
rec=pickle.load(f)
print(rec); c+=1
except:
break
print("Number of records =",c)
4. def search_book():
with open("BOOK.DAT",'rb') as f:
bn=int(input("Enter book number: "))
found=0
while(1):
try:
rec=pickle.load(f)
if rec['BookNo']==bn:
print(rec); found=1
except:
break
if found==0:
print("Book not found")
5. def show_vintage():
found=0
with open("vintage.dat",'rb') as f:
while(1):
try:
rec=pickle.load(f)
if rec[2]>200000 and rec[2]<250000:
print(rec)
found=1
except:
break
if found==0:
print("No such record found")

QB/XII/083/Easy Revision - 2021 35 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
6. def search_laptop():
with open("laptop.DAT",'rb') as f:
mn=int(input("Enter model number: "))
found=0
while(1):
try:
rec=pickle.load(f)
if rec[0]==mn:
print(rec)
found=1
except:
break
if found==0:
print("Laptop not found")
7. def search_mobile():
with open("mobile.DAT",'rb') as f:
found=0
while(1):
try:
rec=pickle.load(f)
if rec[1]>1000:
print(rec)
found=1
except:
break
if found==0:
print("No such record found")
8. def search_game():
with open("GAMES.DAT",'rb') as f:
found=0
while(1):
try:
rec=pickle.load(f)
if rec[2]=="8 to 13":
print(rec)
found=1
except:
break
if found==0:
print("No such record found")
9. def search_item():
with open("items.DAT",'rb') as f:
found=0
while(1):
try:
rec=pickle.load(f)
if rec['Cost']<2500:
print(rec)
found=1
except:
break
if found==0:
print("No such record found")
10. def BUMPER():
with open("gifts.DAT",'rb') as f:
found=0
while(1):
try:
rec=pickle.load(f)
if rec[2]=="ON DISCOUNT":
print(rec)
found=1
except:

QB/XII/083/Easy Revision - 2021 36 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
break
if found==0:
print("No such record found")
Stacks
1. def stackpush(nameStack):
nm=input("Enter name to push: ")
nameStack.append(nm)

def stackpop(stack):
if nameStack==[]:
return None
else:
return nameStack.pop()
2. def stackpush(stack):
bn=int(input("Enter BNo: "))
Desc=input("Enter Description: ")
ele=[bn,Desc]
stack.append(ele)

def stackpop(stack):
if stack==[]:
return None
else:
return stack.pop()
3. def PUSH(TEXTBOOKS):
isbn=int(input("Enter ISBN: "))
title = input("Enter title: ")
price=float(input("Enter price: "))
ele={'ISBN':isbn,'TITLE':title,'PRICE':price}
TEXTBOOKS.append(ele)

def POP(TEXTBOOKS):
if TEXTBOOKS==[]:
return None
else:
return TEXTBOOKS.pop()
4.

5.

RDBMS – Descriptive Questions


(i) A table may have more than one such attribute/group of attributes that identify a row/tuple
uniquely. All such attribute(s)/group(s) are known as Candidate keys. Out of the candidate keys,
one is selected as primary key.
Example:
Relation: Stock
Ino Item Qty Price
I01 Pen 560 2
I02 Pencil 600 1
I03 CD 200 3
In this relation Ino and Item are Candidate keys. Any one of these can be designated as the
Primary key.

QB/XII/083/Easy Revision - 2021 37 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(ii) Degree of a table is the number of coulmns (attributes) in It, whereas Cardinality is the number of
rows (tuples) in it.
Degree of the given table is 3 and its Cardinality is 2.

(iii) A table may have more than one such attribute/group of attributes that identify a row/tuple
uniquely. All such attribute(s)/group(s) are known as Candidate keys. Out of the candidate keys,
one is selected as primary key and the other keys are known an alternate keys.
Example:
Relation: Stock
Ino Item Qty Price
I01 Pen 560 2
I02 Pencil 600 1
I03 CD 200 3
In this relation Ino and Item are Candidate keys. If Ino is selected as the primary key, then Item
will be the alternate key, and vice-versa.

(iv) Candidate keys : Id, Product; Primary key : Id


(v) Candidate keys : Code, Item; Primary keys: Code
(vi) Cartesian Product
Degree = 4
Cardinality = 6

(vii) Cartesian Product


Degree = 4
Cardinality = 6

SQL – Writing queries and finding outputs


(i)
a) SELECT * FROM TEACHER WHERE DEPARTMENT = “History”;
b) SELECT NAME FROM TEACHER WHERE DEPARTMENT = “Maths” AND SEX = “F”;
c) SELECT NAME FROM TEACHER ORDER BY DATE_OF_JOIN;
d) SELECT NAME, SALARY, AGE FROM TEACHER WHERE SEX = “M”;
e) SELECT COUNT(*) FROM TEACHER WHERE AGE>23;
(ii)
a) SELECT * FROM STUDENT WHERE DEPARTMENT = “History”;
b) SELECT * FROM STUDENT WHERE DEPARTMENT = “Hindi” AND SEX=’F’;
c) SELECT * FROM STUDENT ORDER BY DATEOFADM;
d) SELECT NAME, FEE, AGE FROM STUDENT WHERE SEX=“M”;
e) SELECT COUNT(*) FROM STUDENT AGE>23;
(iii)
a) SELECT * FROM CLUB WHERE SPORTS = “Swimming”;
b) SELECT Name FROM CLUB ORDER BY date_of_app desc;
c) SELECT COACHNAME, PAY, AGE, PAY*15/100 AS BONUS FROM CLUB;
d) INSERT INTO CLUB VALUES (11, “Neelam”, 35, “Basketyball”,
“2000/04/01”, 2200, “F”);
e)
i. 4
ii. 34
(iv)
a) SELECT * FROM FURNITURE WHERE TYPE = “Baby cot”;
b) SELECT ITEMNAME FROM FURNITURE WHERE PRICE > 15000;
c) SELECT ITEMNAME, TYPE FROM FURNITURE WHERE DATEOFSTOCK<”2002/01/22”
ORDER BY ITEMNAME DESC;
d) SELECT ITEMNAME, DATEOFSTOCK FROM FURNITURE WHERE DISCOUNT>25;
e) SELECT COUNT(*) FROM FURNITURE WHERE TYPE=”Sofa”;
f) INSERT INTO ARRIVAL VALUES (14, “Valvet touch”, "Double bed",
“2003/03/03”);

QB/XII/083/Easy Revision - 2021 38 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
g)
(i) 5
(ii) 30
(iii) 18.33
(iv) 65500

(v)
a) SELECT GAMENAME, GCODE FROM GAMES;
b) SELECT * FROM GAMES WHERE PRZEMONEY > 7000;
c) SELECT * FROM GAMES ORDER BY SCHEDULEDATE;
d) SELECT NUMBER, SUM(PRIZEMONEY) FROM GAMES GROUP BY NUMBER;

(e1) 2
4
(e2) MAX(ScheduleDate) MIN(ScheduleDate)
----------------- -----------------
19-Mar-2004 12-Dec-2003
(e3) 59000
(e4) 101
108
103
(vi)
(a)
(i) SELECT * FROM WORKER ORDER BY DOB DESC;
(ii) SELECT NAME, DESIG FROM WORKER WHERE PLEVEL IN (“P001”, “P002”);
(iii) SELECT * FROM WORKER WHERE DOB BETWEEN “19-JAN-1984” AND “18-JAN-
1987”;
(iv) INSERT INTO WORKER VALUES
(19, ‘Daya kishore’, ‘Operator’, ‘P003’, ’19-Jun-2008’, ’11-Jul-
1984’);
(b)
(i)
COUNT(PLEVEL) PLEVEL
1 P001
2 P002
2 P003
(ii)
MAX(DOB)) MIN(DOJ)
12-Jul-1987 13-Sep-2004
(iii)
Name Pay
Radhey Shyam 26000
Chander Nath 12000
(iv)
PLEVEL PAY+ALLOWANCE
P003 18000
(vii)
(a)
1) SELECT VehicleName FROM CARHUB WHERE Color = ‘WHITE’;
2) SELECT VehicleName, Make, Capacity FROM CARHUB ORDER BY CAPACITY;
3) SELECT MAX(Charges) FROM CARHUB;
4) SELECT CName, VehicleName, FROM CUSTOMER, CARHUB
WHERE CUSTOMER.Vcode = CARHUB.Vcode;
(b)
1)
COUNT(DISTINCT Make)
4

2)
MAX(Charges) MIN(Charges)
35 12

QB/XII/083/Easy Revision - 2021 39 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
3)
COUNT(*)
5
4)
VehicleName
SX4
C Class

(viii)
a) SELECT * FROM ITEMS ORDER BY INAME;
b) SELECT INAME, PRICE FROM ITEMS WHERE PRICE BETWEEN 10000 AND 22000;
c) SELECT TCODE, COUNT(*) FROM ITEMS GROUP BY TCODE;
d) SELECT PRICE, INAME, QTY FROM ITEMS WHERE QTY > 150;
e) SELECT INAME FROM TRADERS WHERE CITY IN (‘DELHI’, ‘MUMBAI’);
f) SELECT COMPANY, INAME FROM ITEMS ORDER BY COMPANY DESC;
g1 )
MAX(PRICE) MIN(PRICE)
38000 1200

g2 )
AMOUNT
1075000

g3 )
DISTINCT TCODE
T01
T02
T03

g4 )
INAME TNAME
LED SCREEN 40 DISP HOUSE INC
CAR GPS SYSTEM ELECTRONIC SALES
(ix)
(a)
1) SELECT IName, price from Item ORDER BY Price;
2) SELECT SNo, SName FROM Store WHERE Area=’CP’;
3) SELECT IName, MIN(Price), MAX(Price) FROM Item GROUP BY IName;
4) SELECT IName, Price, SName FROM Item, Store Where Item.SNo =
Store.SNo;

(b)
1)
DISTINCT INAME
Hard disk
LCD
Mother Board
2)
Area Count(*)
CP 2
GK II 1
Nehru Place 2
3)
COUNT(DISTINCT AREA)
3
4)
INAME DISCOUNT
Keyboard 25
Mother Board 650
Hard Disk 225

QB/XII/083/Easy Revision - 2021 40 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(x)
(i) SELECT Wno,Name,Gender FROM Worker
ORDER BY Wno DESC;

(ii) SELECT Name FROM Worker


WHERE Gender=’FEMALE’;

(iii) SELECT Wno, Name FROM Worker


WHERE DOB BETWEEN ‘19870101’ AND ‘19911201’;
OR
SELECT Wno, Name FROM Worker
WHERE DOB >=‘19870101’ AND DOB <=‘19911201’

(iv) SELECT COUNT(*) FROM Worker


WHERE GENDER=’MALE’ AND DOJ > ‘19860101’;

(v)
COUNT(*) DCODE
2 D01
2 D05

(vi)
Department
MEDIA
MARKETING
INFRASTRUCTURE
FINANCE
HUMAN RESOURCE

(vii)
NAME DEPARTMENT CITY
George K MEDIA DELHI
Ryma Sen INFRASTRUCTURE MUMBAI

(viii)
MAX(DOJ) MIN(DOB)
2014-06-09 1984-10-19

(xi)
(i) SELECT Eno,Name,Gender FROM Employee ORDER BY Eno;
(ii) SELECT Name FROM Employee WHERE Gender=’MALE’;
(iii) SELECT Eno,Name FROM Employee
WHERE DOB BETWEEN ‘19870101’ AND ‘19911201’;
OR
SELECT Eno,Name FROM Employee
WHERE DOB >=‘19870101’ AND DOB <=‘19911201’;
OR
SELECT Eno,Name FROM Employee
WHERE DOB >‘19870101’ AND DOB <‘19911201’;

(iv) SELECT count(*) FROM Employee


WHERE GENDER=’FEMALE’ AND DOJ > ‘19860101’;
OR
SELECT * FROM Employee
WHERE GENDER=’FEMALE’ AND DOJ > ‘19860101’;

(v) COUNT DCODE


2 D01
2 D05

QB/XII/083/Easy Revision - 2021 41 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(vi) Department
INFRASTRUCTURE
MARKETING
MEDIA
FINANCE
HUMAN RESOURCE
(vii) NAME DEPARTMENT
George K INFRASTRUCTURE
Ryma Sen MEDIA
(viii) MAX(DOJ) MIN(DOB)
20140609 19841019

(xii)
(i) SELECT NO, NAME, TDATE FROM TRAVEL ORDER BY NO DESC;
(ii) SELECT NAME FROM TRAVEL
WHERE CODE=101 OR CODE=102;
(iii) SELECT NO, NAME from TRAVEL
WHERE TDATE BETWEEN ‘2015-04-01’ AND ‘2015-12-31’;
(iv) SELECT * FROM TRAVEL WHERE KM > 100 ORDER BY NOP;

(v) COUNT(*) CODE


2 101
2 102
(vi) DISTINCT CODE
101
102
103
104
105
(vii) CODE NAME VTYPE
104 Ahmed Khan CAR
105 Raveena SUV
(viii) NAME KM*PERKM
Raveena 3200

(xiii)
(i) SELECT CNO, CNAME, TRAVELDATE FROM TRAVEL ORDER BY CNO DESC;

(ii) SELECT CNAME FROM TRAVEL


WHERE VODE=V01 OR VCODE=V02;

(iii) SELECT CNO, CNAME from TRAVEL


WHERE TRAVELDATE BETWEEN ‘2015-12-31’ AND ‘2015-05-01’;

(iv) SELECT * FROM TRAVEL


WHERE KM > 120 ORDER BY NOP;
(v)
COUNT(*) VCODE
2 V01
2 V02

(vi)
DISTINCT VCODE
V01
V02
V03
V04
V05

QB/XII/083/Easy Revision - 2021 42 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
(vii)
VCODE CNAME VEHICLETYPE
V02 Ravi Anish AC DELUXE BUS
V04 John Malina CAR
(viii)
CNAME KM*PERKM
Sahanubhuti 2700

Computer Networks – Descriptive questions


1. A computer network is a collection of interconnected computers and other devices which are able to
communicate with each other and share hardware and software resources.
2. HTTP – Hyper Text Transfer Protocol
HTTPS – Hyper Text Transfer Protocol Secure
SSH – Secure Shell
SCP – Secure Copy Protocol
POP – Post Office Protocol
IMAP – Internet Message Access Protocol
SMTP – Simple Mail Transfer Protocol
FTP – File Transfer Protocol
VoIP – Voice over Internet Protocol
URL – Uniform Resource Locator
GPRS - General Packet Radio Service
3. VoIP (Voice Over Internet Protocol) is a protocol used for transmission of voice and multimedia content
over Internet Protocol (IP) networks.
4. VoIP
5. URL – www.google.com/en/index.html
Domain Name – www.google.com
6. Domain Name: It is the unique name that identifies an Internet site
IP Address: It is the unique address for each device on a TCP/IP network
7. (i) No need of repeater
(ii) High speed data transfer
8. 2G: Better voice service, Speed around 64kbps
3G: Improved data services with multimedia, Speed around 2Mbps
9. PAN
10. (i) Customer pays only for the services used.
(ii) Customer gets almost all the resources demanded without worrying about from how and from where
to procure these.
11. FTP is used to transfer files over a network, whereas http is used to transfer hyper text files (web pages)
over a network.
12. Wired – Optical Fiber, Wireless – Microwave
13. PAN Examples:
(i) Connecting two cell phones to transfer data
(ii) Connecting smartphone to a smart watch
LAN Examples:
(i) Connecting computers in a school
(ii) Connecting computers in an office
14. HTTP and HTTPS. Internet browser – Google Chrome
15. (i) 4G gives a speed of approximately 100 Mbps whereas 3G gives a speed of approximately 2 Mbps
(ii) 4G takes less time than 3G in call establishment

QB/XII/083/Easy Revision - 2021 43 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
16.
PAN LAN
A PAN (personal area network) is a computer A LAN (Local Area Network) interconnects a
network organized around an individual person. high number of access or node points or
stations within a confined physical area upto a
kilometer.

17. FTP
18. Speed ‐
• Faster web browsing
• Faster file transfer
Service ‐
• Better video clarity
• Better security
19. Attenuation: Reduction in the strength of a signal during transmission. It happens when a signal travels
long distances over a network.
20. IPv4 is a 32 bit address, whereas IPv6 is a 128 bit address. Examples:
IPv4: 192.168.72.54 IPv6: 2001:0cb8:85a3:0000:0000:8c2e:0370:7a34
21.
Physical Address Logical Address
It is the MAC address of the NIC of the device. It is the IP address of the device.
It is used by switches for communication within a It is used by routers for communication
network. between networks.
22. Guided media refers to cables such as Twisted Pair cables, Coaxial cables, and Optical Fiber cables.
Unguided media refers to waves such as radio waves, micro waves, and infrared rays.

23. (i) Remote Login: Using remote login, a user is able to access a computer or a network remotely through a
network connection. Remote login enables users to access the systems they need when they are not
physically able to connect directly.

(ii) Remote Desktop: Remote desktop is a program or an operating system feature that allows a user to
connect to a computer in another location, see that computer's desktop and interact with it as if it were
local.

24. Application Layer is the top most Layer of a computer network, and is implemented in end nodes e.g.
computers. Some protocols of Application Layer are FTP(File Transfer Protocol), HTTP (Hyper Text Transfer
Protocol) , SMTP (Simple Mail Transfer Protocol) etc.
25. (i) Wi-fi is a technology that is used for short distance wireless communication. Wi-Fi uses radio waves of
frequency 2.4GHz and 5GHz.

(ii) Access Point: It is a device in a wireless network that broadcasts a wireless signal that devices can detect
and "tune" into.
26. DNS (domain name system): It is a system of remote servers used to convert domain names to their
corresponding IP addresses.
27.
Bus Topology Star Topology
Slower as compared to Star topology of network Expensive as compared to Bus
topology
Breakage of wire at any point disturbs the entire Long wire length is required.
network.

28. 1) Optical Fiber can carry data without any loss


2) Optical fiber can carry data at the speed of light
29. Video Conferencing: It is a conference between two or more participants at different locations in real time
over the Internet or a private network using video camera, microphone and speakers.

QB/XII/083/Easy Revision - 2021 44 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
30. A worm is a self‐replicating computer program. It uses a network to send copies of itself to other
computers on the network and it may do so without any user intervention.
Most of the common anti‐virus(anti‐worm) remove worm.
A Trojan Horse is a code hidden in a program, that looks safe but has hidden side effects typically causing
loss or theft of data, and possible system harm.
31. When a Website with cookie capabilities is visited, its server sends certain information about the browser,
which is stored in the hard drive as a text file. This text file is called a cookie. It's a way for the server to
remember things about the visited sites.
32. Packet Switching follows store and forward principle for fixed packets. Fixes an upper limit for packet size.
In Circuit Switching a physical connection is established between the sender and the receiver machines and
this connection is sustained for the full duration of communication.
33. (a) Digital property: Digital property includes data, Internet accounts, and other rights in the digital world,
including contractual rights and intellectual property rights. Data are the files and information stored and
used by computers (such as e–mails, word processing documents, spreadsheets, pictures, audio files, and
movies).
(b) Intellectual property is a category of property that includes intangible creations of the human intellect.
It generally includes inventions, literary and artistic works, symbols, names, and images.
(c) Intellectual Property rights are legal rights governing the use of intellectual property.
34. (a) Plagiarism is an act of taking someone else's work or ideas and passing them off as one's own. It is an
act of fraud.
(b) A scam or confidence trick is an attempt to defraud a person or group by gaining their confidence.
(c) Identity theft is the deliberate use of someone else's identity, usually as a method to gain a financial
advantage or obtain credit and other benefits in the other person's name.
(d) Phishing is the fraudulent attempt to obtain sensitive information such as usernames, passwords
and credit card details by disguising oneself as a trustworthy entity in an electronic communication.
(e) Illegal downloading is obtaining copyrighted files that you do not have the right to use from the Internet.
(f) Child pornography is any visual depiction of sexually explicit conduct involving a minor (persons less than
18 years old). Images of child pornography are also referred to as child sexual abuse images.
(g) Spam mail: Spam email (or junk email), is an email sent without explicit consent from the recipient. Spam
emails usually try to sell questionable goods or are downright deceitful.
35. Cyber forensics ( or computer forensics) is a branch of digital forensic science pertaining to evidence
found in computers and digital storage media. The goal of computer forensics is to examine digital media
in a forensically sound manner with the aim of identifying, preserving, recovering, analyzing and
presenting facts and opinions about the digital information.
36. The Information Technology Act, 2000 (also known as ITA-2000, or the IT Act) is an Act of the Indian
Parliament (No 21 of 2000) notified on 17 October 2000. It is the primary law in India dealing
with cybercrime and electronic commerce.
37. (a) A Creative Commons (CC) license is one of several public copyright licenses that enable the free
distribution of an otherwise copyrighted "work". A CC license is used when an author wants to give other
people the right to share, use, and build upon a work that they (the author) have created
(b) GPL (General Public License) is a series of widely used free software licenses that guarantee end users
the freedom to run, study, share, and modify the software.
(c) The Apache License is a permissive free software license written by the Apache Software Foundation
(ASF). It allows users to use the software for any purpose, to distribute it, to modify it, and to distribute
modified versions of the software under the terms of the license, without concern for royalties.
38. (i) Identity theft, (ii) fraud, (iii) spam, (iv) fraud, (v) hacking
39. (ii), (iii)
40. (ii), (iii)

QB/XII/083/Easy Revision - 2021 45 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2
Computer Networks - Network Setup
(i)
a) HR Center as it has the maximum number of computers.
b)

c) Switch
d) WAN as the given distance is more than the range of LAN and MAN.

(ii)
a) Building “Jamuna” as it contains the maximum number of computers.
b)

c)
(i) Switch is needed to be placed in each building to interconnect the computers within
that building.
(ii) Repeater is needed to be placed between “Jamuna” and “Ravi” as the distance is
more than 90m.

d) Optical Fibre cable

(iii)
a) Faculty Studio as it contains the maximum number of computers.
b)

c) LAN
d) Satellite
(iv)
a) Finance
b)

c) Satellite Link
d) Switch

QB/XII/083/Easy Revision - 2021 46 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

(v)
a) ADMIN (due to maximum number of computers)
OR
MEDIA (due to shorter distance from the other buildings)

b) Any one of the following:

c) Firewall OR Router
d) Video Conferencing

(vi)
a) ADMIN (due to maximum number of computers)
OR
ARTS (due to shorter distance from the other buildings)

b) Any one of the following

c) Firewall OR Router
d) Video Conferencing

(vii)
a) B_TOWN. Since it has the maximum number of computers and is closest to all other
locations.

b)

c) Switch OR Hub
d) Videoconferencing OR VoIP OR any other correct service/protocol

(viii)
a) B_TOWN. Since it has the maximum number of computers and is closest to all other
locations

b)

QB/XII/083/Easy Revision - 2021 47 © Yogesh Kumar


QB/XII/083/Easy Revision – 2021/Part-2

c) Switch OR Hub
d) Videoconferencing OR VoIP OR any other correct service/protocol

QB/XII/083/Easy Revision - 2021 48 © Yogesh Kumar

You might also like