[go: up one dir, main page]

0% found this document useful (0 votes)
129 views60 pages

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

cbse class 12 computer science full portions

Uploaded by

filip marques
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)
129 views60 pages

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

cbse class 12 computer science full portions

Uploaded by

filip marques
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/ 60

Computer Science

[Question Bank for Easy Revision – Part 2]

[QB/XI/083/Easy Revision - 2020]


QB/XI/083/Easy Revision – 2020/Part-2
Descriptive Questions:
1. What is a function in Python?
2. Differentiate between actual parameters and formal parameters. Give a suitable example also.
3. Differentiate between value and reference parameters. Give a suitable example also.
4. What is meant by the scope of a variable?
5. Differentiate between local and global variables. Give a suitable example also.
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. What is recursion? Give an example of a recursive function.
12. What is base case (base condition)? Explain with the help of an example. What happens when the
base case becomes true?
13. What is recursive case (recursive condition)? Explain with the help of an example.
14. Fill in the blanks in each of the following function codes to perform the specified job:
(i) #To find the sum of the elements of a list
def sumList(L):
if L==[]:
return __
else: return L[0]+sumList(_____)

(ii) #To find the product of elements of a tuple


def proTuple(T):
if T==__:
return 1
else: return T[__]*proTuple(T[1:])

(iii) #To find the factorial of a number


def Factorial(n):
if n==0:
return 1
else: return __*________(n-1)

(iv) #To find the sum of the digits of a positive integer


def sumDigits(n):
if _____:
return n
else: return __%10+sumDigits(____)

(v) #To check whether a given string is palindrome or not


def palindrome(s):
if len(s)<=1:
return _____
elif s[0]!=s[-1]:
return False
else: return palindrome(s[______])
(vi) #To find the HCF of two numbers
def HCF(m,n):
if m%n==0:
return n
else: return HCF(n,____)

QB/XI/083/Easy Revision - 2020 1 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(vii) #To find the sum of first n natural numbers
def Sum(n):
if n==0:
return 0
else: return n+________
15. 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))
16. What is a python module? Give an example of an inbuilt python module.
17. What is a python package? Give an example of a python package.
18. What is a python library? Give an example of a python library.
19. 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.
20. What is a file?
21. Why do we need files?
22. What are two main categories of file types?
23. What is the difference between a text file and a binary file?
24. What are the two basic operations which are performed on a file?
25. What is a file buffer?
26. How can a file be opened in a Python program?
27. What are different file opening modes for a text file in Python? Write, in brief, what does each mode
do?
28. Differentiate between ‘write’ mode and ‘append’ mode.
29. What different functions are available to write data in a text file? Describe each in brief.
30. What different functions are available to write read data from a text file? Describe each in brief.
31. Why is it important to close a file?
32. 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.
33. Differentiate between seek() and tell().
34. What is the difference between a binary file and a text file?
35. Which functions are used to (i) rename a file, (ii) delete a file? In which module are these functions
available?
36. What are the three standard input-output streams in Python?
37. Define the terms ‘pickling’ and ‘unpickling’.
38. In context of program efficiency, define:
(i) Worst case (ii) Best case (iii) Average case
39. What is meant by the statement: “Program efficiency is inversely proportional to the clock time”?
40. What is a stack?
41. Define the terms TOP, PUSH, POP in context of stacks.
42. How can a stack be implemented in Python?

QB/XI/083/Easy Revision - 2020 2 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
43. Define the terms Overflow and Underflow in context of stacks.
44. What is a queue?
45. Differentiate between a queue and a stack.
46. What is meant by efficiency of a program?
47. What is Big O notation?
48. Which algorithm is better – of complexity O(n), or of complexity O(n2)?
49. Which algorithm is better – O(1) or O(log n)?
50. Four algorithms – A1, A2, A3, and A4, perform the same task. Their respective complexities are
O(n), O(1), O(n2), and O(log n) to do the same. Arrange these algorithms in the ascending order of
their efficiencies.
51. Which function of pyplot module is used to draw:
(i) Bar chart
(ii) Horizontal bar chart
(iii) Pie chart
(iv) Line graph
52. What is a Web Application framework? Also, give an example of a Web Application framework.
53. What is Django?
54. What is the role of views.py and urls.py in a Django project?
55. What is the role of settings.py in a Django project?
56. What is the use of HttpResponse() function?
57. What is the use of render() function?
58. What is the difference between GET and POST methods of submitting forms?
59. What is a csv file? How is it different from a plain text file?
60. Define connection and cursor w.r.t. Python interface with an SQL database.
61. What is the role of fetchone() method?
62. What is the function of fetchall() method?
63. What is the function of fetchmany() method?
64. 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
65. 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
66. 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
67. 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)

QB/XI/083/Easy Revision - 2020 3 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(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()

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')

QB/XI/083/Easy Revision - 2020 4 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(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')

(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. Find output of each of the following code snippets in Python:


(i) def f1(n):
if n<10:
return 10
else: return 2+f1(n-2)
print(f1(14))

(ii) def f2(n=None):


if n==None:
n=5
return f2(n)
elif n<1:
return 1
else: return n*f2(n//2)
print(f2())
print(f2(8))

(iii) def f3(k):


if k>10:
return k*f3(k-3)
elif k>5:
return 5
else: return f3(k+1)
print(f3(1))
print(f3(8))

QB/XI/083/Easy Revision - 2020 5 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
print(f3(10))
print(f3(13))

(iv) def f4(a,b):


if a==b:
return a*b
elif a>b:
return a*f4(a//b,b)
else: return a+f4(a,b//a)

print(f4(5,5))
print(f4(12,5))
print(f4(5,12))

3. 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()

4. Draw an approximate labelled sketch of the graph/chart generated by the following code. Also
specify the color of the chart:
(i) from matplotlib import pyplot as plt
year = [2010, 2011, 2012, 2013, 2014, 2015]
inflation = [12, 9, 9, 11, 6, 5]
plt.plot(year, inflation, color='g')
plt.xlabel('Years')
plt.ylabel('Rate of Inflation')
plt.title("Inflation Rate 2010-2015")
plt.show()

(ii) from matplotlib import pyplot as plt


year = [2010, 2011, 2012, 2013, 2014, 2015]
GDP = [9, 5, 5, 6, 7, 8]
plt.plot(year, GDP, color='r')
plt.xlabel('Years')
plt.ylabel('GDP Growth Rate')
plt.title("GDP Growth rate 2010-2015")
plt.show()

(iii) from matplotlib import pyplot as plt


year = [2010, 2011, 2012, 2013, 2014, 2015]
GDP = [9, 5, 5, 6, 7, 8]
plt.bar(year, GDP)
plt.xlabel('Years')
plt.ylabel('GDP Growth Rate')
plt.title("GDP Growth rate 2010-2015")
plt.show()

(iv) from matplotlib import pyplot as plt


year = [2010, 2011, 2012, 2013, 2014, 2015]
GDP = [9, 5, 5, 6, 7, 8]
plt.barh(year, GDP)
plt.ylabel('Years')
plt.xlabel('GDP Growth Rate')
plt.title("GDP Growth rate 2010-2015")
plt.show()

Rewrite the code:


1. Rewrite each of the following recursive functions as iterative functions:
QB/XI/083/Easy Revision - 2020 6 © Yogesh Kumar
QB/XI/083/Easy Revision – 2020/Part-2
(i) def f1(n):
if n<10:
return 10
else: return 2+f1(n-2)
print(f1(14))
(ii) def f2(n=None):
if n==None:
n=5
return f2(n)
elif n<1:
return 1
else: return n*f2(n//2)
print(f2())
print(f2(8))

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".
4. Write a recursive function in Python to calculate and return nth term of Fibonacci series. First few
terms of Fibonacci series are: 0 1 1 2 3 5 8 13 . . .
5. Write a recursive function in Python to perform binary search on a sorted list.
6. Write a recursive function in Python to display first m multiples of n, where m and n are passed as
arguments to the function.
7. Write a recursive function in Python to find the sum of first n terms of the series:
sin(0)+sin(0.1)+sin(0.2)+. . .
8. Write a recursive function in Python to calculate and return the factorial of a number passed as a
parameter.
9. Recursive code to find the sum of all elements of a list.
10. Recursive function to check if a string is palindrome.

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)
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

QB/XI/083/Easy Revision - 2020 7 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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)
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)

QB/XI/083/Easy Revision - 2020 8 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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

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.

QB/XI/083/Easy Revision - 2020 9 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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)
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.

QB/XI/083/Easy Revision - 2020 10 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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.
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.

QB/XI/083/Easy Revision - 2020 11 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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')

Queues
1. Write functions Q_insert(nameQueue) to insert a new name and Q_delete(nameQueue) to
delete a name from a queue implemented using a list. The list is passed as an argument to
these functions.
2. Each element of a queue ITEM (a list) is a list containing two elements BNo (integer), and
Description (String). Write functions to insert an element in the queue and to delete an
element from the queue. The deleted element should be returned by the function. If the queue
is empty, the delete function should return None.
3. Each element of a queue 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) INSERT(TEXTBOOKS) to insert an element in the queue. The details of the book to
be inserted are to be input from the user.
(ii) DELETE(TEXTBOOKS) to delete an element from the queue. The deleteed element
should be returned by the function. If the queue is empty, the delete function should
return None.

Data Visualization using Pyplot


1. Which python library provides the interface and functionality for 2D graphics?
2. Which functions of pyplot module are used to draw:
(a) Line chart
(b) Pie chart
(c) Vertical bar chart
(d) Horizontal bar chart
3. Which function is used to save the charts created using pyplot? Specify any four file formats
in which a chart can be saved. Which of these file formats is the default formats?
4. Which function is used to display the charts created using pyplot?
5. What is meant by ‘legend’ with reference to charts? By default, in which part of the chart is
the legend shown?

QB/XI/083/Easy Revision - 2020 12 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
6. A student, Afzal, got 86,90,95,88, and 79 marks in subjects Eng, Hindi, Math, Sc, and SSc
respectively. Write a function in Python to show this data as a bar graph. The x-axis should
be labelled as “Subjects”, y-axis should be labelled as “Marks”, and chart title should be
“Afzal’s Marks”. Different bars should be colored with different colors.
7. Number of goals scored by two players P1 and P2 in four leagues L1, L2, L3, and L4 are
given below:
P1: 12, 15, 10, 11; P2: 13, 14, 13, 15
Write a Python function to show this data in the form of line charts in the same plotting area.
Other specifications of the chart are given below:
Chart title: “Comparative Chart”
X label: “Leagues”
Y label: “Goals”
Legend: “P1” and “P2”
8. In a city there are 300 pet dogs, 120 pet cats, 250 pet fish, 180 pet turtles, and 100 pet rats.
Write a function in Python to show this data as a pie chart. Other specifications of the chart
are given below:
(a) Chart title: “Pets in the City”
(b) Explode: The slice representing Dogs should by shown exploded
(c) Color: different slices of the chart should have different colors
(d) Labels and data: Each label (pet animal name) should be shown with the respective
slice and its percentage should be shown in the respective slice.
9. Write a Python function to draw te sin graph for angles in the range 0 to 360 degrees in steps
of 5 degrees.
10. Write a Python function to draw the graph for a linear expression 2x-3 for the values of x
ranging from -5 to 11 in steps of 1.
11. Write a Python function to draw the graph for a linear expression x2+2x-3 for the values of x
ranging from -5 to 11 in steps of 1.

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)

QB/XI/083/Easy Revision - 2020 13 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
Code Item Qty Price Transaction Date
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/XI/083/Easy Revision - 2020 14 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 15 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 16 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 17 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 18 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 19 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 20 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 21 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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
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 do you understand by IoT?
20. Define client-server model of a computer network.
21. What is cloud computing? What are the three types of services provided on cloud?
22. Write any two advantages and two disadvantages of cloud computing.
23. Differentiate between private cloud and public cloud with one example of each.
24. What is attenuation?
25. What is secure connection? How can it be achieved?
26. Differentiate between IPv4 and IPv6 addresses with an example of each.
27. Differentiate between carrier waves and signal waves.
28. Define the terms modulation and demodulation w.r.t. unguided media.
29. Differentiate between AM and FM.
30. What is meant by collision in a network? How does it affect the performance of a network?
31. How is collision prevention different from collision resolution?
32. What is a routing table?
33. Explain the following network tools:
(i) ping (ii) traceroute (tracert) (iii) ipconfig (iv) nslookup (v) whois (vi) speed-test

QB/XI/083/Easy Revision - 2020 22 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
34. Which network tool should be used in the following situations:
(i) To check how long it takes for packets to reach a host
(ii) To test the connectivity between two nodes on a network
(iii) To trace the route of packets from source host to destination host
(iv) To look up DNS record
(v) To check the contact information for an IP or domain
(vi) To check the IP configuration of your computer
(vii) To control the network connections on your computer
(viii) to lookup the specific IP address(es) associated with a domain name
(ix) to determine the Internet bandwidth available to a specific host
(x) To determine the quality of Internet connection being used
35. Differentiate between physical address and logical address of a node in a computer network.
36. Differentiate between Guided media and Unguided media with an example of each.
37. Explain the terms: (i) remote login (ii) remote desktop
38. What is Application layer in a computer network?
39. Explain the terms: (i) Wi-Fi (ii) Access Point?
40. Expand and explain the term DNS.

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
a) Suggest the most suitable place (i.e., Block/Center) to install the server of this University with a
suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
c) 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.
d) 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)

QB/XI/083/Easy Revision - 2020 23 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2

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)

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

QB/XI/083/Easy Revision - 2020 24 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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

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:

QB/XI/083/Easy Revision - 2020 25 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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.

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

QB/XI/083/Easy Revision - 2020 26 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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:


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?

QB/XI/083/Easy Revision - 2020 27 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(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:

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

QB/XI/083/Easy Revision - 2020 28 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
6. Define the following terms:
(a) open source (b) open data (c) privacy
7. Write two positive and two negative impacts of technology on society.
8. Mention any two cultural changes induced by technology.
9. What is electronic waste?
10. Write any two methods to reduce e-waste.
11. Why is the proper disposal of electronic waste important?
12. Mention any two methods of proper disposal of e-waste.
13. What is meant by biometrics?
14. Write any two advantages and two disadvantages of using biometrics.
15. Mention any two disability issues that arise in teaching and using computers. How can these be
handled effectively?
16. What is meant by privacy of data? Why is data privacy important?
17. 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
18. 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.

19. 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.

QB/XI/083/Easy Revision - 2020 29 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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 a variable, a literal, or any other valid Has to be a variable 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 header 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

QB/XI/083/Easy Revision - 2020 30 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(i) Specify the global variable(s) which need to be updated in the function
(ii) Declare global variable(s) inside a function.
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. Recursion is the concept of a function calling itself. Example of a recursive function:
def cal_sum(n):
if n==0:
return 0
else: return n+cal_sum(n-1)
12. Base condition is the condition in a recursive function when the function stops calling itself. Example:
def cal_sum(n):
if n==0:
return 0
else: return n+cal_sum(n-1)
In the above recursive function, n==0 is the base condition.
When the base condition becomes True, the function does not call itself, and after that back tracking
of previous recursive calls, if any, starts.
13. Recursive case is the condition in which function calls itself. Example:
def cal_sum(n):
if n==0:
return 0
else: return n+cal_sum(n-1)
In the above recursive function, n==0 is the base condition. When n is not 0, the function calls itself.
So, here is recursive case is n!=0.
14.
(i) #To find the sum of the elements of a list
def sumList(L):
if L==[]:
return 0
else: return L[0]+sumList(L[1:])

(ii) #To find the product of elements of a tuple


def proTuple(T):
if T==():
return 1
else: return T[0]*proTuple(T[1:])

(iii) #To find the factorial of a number


def Factorial(n):
if n==0:
return 1
else: return n*Factorial(n-1)

QB/XI/083/Easy Revision - 2020 31 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(iv) #To find the sum of the digits of a positive integer
def sumDigits(n):
if n<10:
return n
else: return n%10+sumDigits(n//10)

(v) #To check whether a given string is palindrome or not


def palindrome(s):
if len(s)<=1:
return True
elif s[0]!=s[-1]:
return False
else: return palindrome(s[1:-1])

(vi) #To find the HCF of two numbers


def HCF(m,n):
if m%n==0:
return n
else: return HCF(n,m%n)

(vii) #To find the sum of first n natural numbers


def Sum(n):
if n==0:
return 0
else: return n+Sum(n-1)

15.
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
16. 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).
17. 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.
18. A library is a collection of
19.
(i) From myModule import alpha
(ii) From Computer import comp1(), comp2()
(iii) From lib import pkg
(iv) From HR import Salary
(v) Import Trigonometry
20. A file is a named collection of data stored on a secondary storage device.
21. Files are needed for permanent storage of data.
22. Text file and Binary file.
23.
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.

QB/XI/083/Easy Revision - 2020 32 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
24. Writing data in the file, Reading data from the file.
25. 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.
26. A file can be opened using the open() function.
27.
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.
‘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.
28.
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.

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


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

30. 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.
31. 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.
32. (i) append (ii) read (iii) write (iv) append
33.
seek() tell()
Sets the file pointer. Returns the value of file pointer.
Takes one integer parameter. Does not take any parameter.
34.
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).
35. rename() function is used to rename a file. remove() function is used to delete a file. These function
are available in the os module.
36. stdin, stdout, stderr
37. 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.
38. Worst case – The case when the program consumes maximum resources (time and memory) to
process the given data.
Best case – The case when the program consumes minimum resources (time and memory) to process
the given data.
Average case – The case when the program consumes average resources (time and memory) to
process the given data.

QB/XI/083/Easy Revision - 2020 33 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
39. “Program efficiency is inversely proportional to clock time”, it means that a more efficient program will
take less time than a less efficient program to process the given data. Or the more efficient a program
is, the less time it will take to process the given data.
40. A stack is a linear data structure which is used for LIFO type of data processing.
41. 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.
42. A stack can be implemented in Python using a list.
43. 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.
44. A queue is a linear data structure which is used for FIFO type of data processing.
45.
Queue Stack
Used for FIFO type of data processing. Used for LIFO type of data processing.
Has two open ends – one for insertion and one for Has one open end – insertions and deletions
deletion. are done from the same open end.
46. Efficiency of a program is the measure of how much time the program takes to process a given amount
of data. The less time a program takes, the more efficient it is.
47. Big O notation is used to classify algorithms according to how their running time or space requirements
grow as the input size grows.
48. O(n)
49. O(1)
50. A2, A4, A1,A3
51. (i) bar(), (ii) barh(), (iii) pie, (iv) plot
52. A Web Application framework is a collection of packages or modules which allow easy development
and testing of web applications. Django is an example of a Web Application framework.
53. Django is a Web Application framework in Python.
54. Views.py is the default module to store functions representing web pages in a Django project. URLs.py
is the default module to map the web pages to URLs in a Django project. This is done by using a list
named urlpatterns in the module URLs.py
55. Settings.py stores all the settings of a Django project.
56. In a Django project, HttpResponse() function is used to return a text as a web page to the browser.
57. In a Django project, render() function is used to return a file (usually an html file) as a web page to the
browser.
58.
GET POST
GET method is used to send plain text data to the POST is used to send any type of data to a
server. server.
Data sent by GET method is visible as a query Data sent by POST method is not visible
string in the responded URL from server. anywhere in the browser.
59. 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.
60. 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.
61. 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.
62. 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.
63. 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.
64. While, Float, new, Amount2, _Counter
65. For, INT, NeW, delete, name1
66. Pr*Qty, float, Address One, in
67. Total Tax, S.I.

QB/XI/083/Easy Revision - 2020 34 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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. Find output of each of the following code snippets in Python:


(i) 16
(ii) 10
64
(iii) 5
5
5
65
(iv) 25
72
25
3. 9

QB/XI/083/Easy Revision - 2020 35 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
4. (i)

(ii)

(iii)

(iv)

QB/XI/083/Easy Revision - 2020 36 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
Rewrite:
1.
(i) def f1(n):
s=0
while n>=10:
s+=2
n-=2
else:
s+=10
return s
print(f1(14))
(ii) def f2(n=None):
if n==None:
n=5
p=1
while n>=1:
p*=n
n//=2
return p
print(f2())
print(f2(8))

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()

QB/XI/083/Easy Revision - 2020 37 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2

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

4. def fibo(n):
if n<=1:
return n
else: return fibo(n-1)+fibo(n-2)

5. def binSearch(A,ele,beg=0,end=None):
if end==None:
end=len(A)
if beg>end:
return None;
else:
mid=(beg+end)//2
if A[mid]==ele:
return mid
elif A[mid]>ele:
return binSearch(A,ele,beg,mid-1)
else: return binSearch(A,ele,mid+1,end)

6. def multiples(m,n,start=1):
if start==m+1:
return
else:
print(n*start)
start+=1
multiples(m,n,start)

7. def sum_sin(n):
from math import sin
if n==1:
return sin(0)
else:
return sin((n-1)*0.1)+sum_sin(n-1)
8. def fact(n):
if n<=1:
return 1
else: return n*fact(n-1)

9. def sumArray(A):
l=len(A)
if l==0:
return 0
else: return A[0]+sumArray(A[1:])

QB/XI/083/Easy Revision - 2020 38 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
10. def palindrome(s):
l=len(s)
if l<=1:
return True
elif s[0]!=s[-1]:
return False
else: return palindrome(s[1:-1])

Text File Operations


1. 4
2. def count_spaces():
with open("para.txt") as f:
data=f.read()
c=data.count(' ')
return(c)
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()

QB/XI/083/Easy Revision - 2020 39 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
8. def copy():
f1=open("FAIPS.txt")
f2=open("DPS.txt",'w')
for line in f1:
line=line.split()
for word in line:
if word[0].isupper():
f2.write(word+" ")
f2.write("\n")
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])
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)

QB/XI/083/Easy Revision - 2020 40 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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()
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()

QB/XI/083/Easy Revision - 2020 41 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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)
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))

QB/XI/083/Easy Revision - 2020 42 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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
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")

QB/XI/083/Easy Revision - 2020 43 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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")
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:

QB/XI/083/Easy Revision - 2020 44 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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:
break
if found==0:
print("No such record found")

Stacks
1. def stackpush(nameStack):
nm=input("Enter name to push: ")
nameStack.insert(0,nm)

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

def stackpop(stack):
if stack==[]:
return None
else:
return stack.pop(0)
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.insert(0,ele)

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

5.

QB/XI/083/Easy Revision - 2020 45 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
Queues
1. def Q_insert(nameQueue):
nm=input("Enter name to push: ")
queue.append(nm)
def Q_delete(nameQueue):
if queue==[]:
return None
else:
return queue.pop(0)
2. def q_insert(queue):
bn=int(input("Enter BNo: "))
Desc=input("Enter Description: ")
ele=[bn,Desc]
queue.append(ele)

def q_delete(queue):
if queue==[]:
return None
else:
return queue.pop(0)
3. def INSERT(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 DELETE(TEXTBOOKS):
if TEXTBOOKS==[]:
return None
else:
return TEXTBOOKS.pop(0)

Data Visualization using Pyplot


1. Matplotlib
2. (a) plot() (b) pie() (c) bar() (d)barh()
3. savefig()
Supported file formats: eps, pdf, pgf, png, ps, raw, rgba, svg,
svgz (any four)
Default file format: png
4. show()
5. A Legend is a representation of entries on the plotted area of chart which are linked to the data
table of the chart.
By default, a legend is shown in the top left part of the chart.
6. def drawMarks():
sub=['Eng','Hindi','Math','Sc','SSc']
marks=[86,90,95,88,79]
plt.title("Afzal's Marks")
plt.xlabel("Subjects")
plt.ylabel("Marks")
plt.bar(sub,marks,color=['r','y','b','g','k'])
plt.show()
7. def Goals():
P1=[12,15,10,11]
P2=[13,14,13,15]
Leagues=['L1','L2','L3','L4']
plt.title('Comparative Chart')
plt.plot(Leagues,P1,label='P1')
plt.plot(Leagues,P2,label='P2')

QB/XI/083/Easy Revision - 2020 46 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
plt.xlabel('Leagues')
plt.ylabel('Goals')
plt.legend()
plt.show()
8. def Pets():
Animal=['Dogs','Cats','Fish','Turtles','Rats']
Number=[300, 120, 250, 180, 100]
plt.title('Pets in the City')
color=['r','g','y','b','k']
explode=[0.1,0,0,0,0]
plt.pie(Number, labels=Animal, colors=color, explode=explode,
autopct="%0.1f%%")
plt.show()
9. def Sin():
import math
degrees=[d for d in range(0,361,5)]
radians=[math.radians(d) for d in degrees]
sin=[math.sin(x) for x in radians]
plt.plot(degrees,sin)
plt.plot(degrees,[0 for x in degrees],'k')
plt.plot([0,0,0],[1,0,-1],'k')
plt.xlabel("Angle in degrees")
plt.ylabel("sin(degrees)")
plt.title("sin(x)")
plt.show()

10. def Linear():


import math
xvalues=[x for x in range(-5,11)]
yvalues=[2*x-3 for x in xvalues]
print(xvalues)
print(yvalues)
plt.plot(xvalues,yvalues)
plt.xlabel("x -->")
plt.ylabel("y -->")
plt.title("y=2x-3")
plt.show()

11. def Quadratic():


import math
xvalues=[x for x in range(-5,11)]
yvalues=[x*x+2*x-3 for x in xvalues]
print(xvalues)
print(yvalues)
plt.plot(xvalues,yvalues)
plt.xlabel("x -->")
plt.ylabel("y -->")
plt.title("y=x^2+2x-3")
plt.show()

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

QB/XI/083/Easy Revision - 2020 47 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
In this relation Ino and Item are Candidate keys. Any one of these can be designated as the
Primary key.

(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”;

QB/XI/083/Easy Revision - 2020 48 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
f) INSERT INTO ARRIVAL VALUES (14, “Valvet touch”, "Double bed",
“2003/03/03”);
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/XI/083/Easy Revision - 2020 49 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 50 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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/XI/083/Easy Revision - 2020 51 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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

QB/XI/083/Easy Revision - 2020 52 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(vi)
DISTINCT VCODE
V01
V02
V03
V04
V05
(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
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

QB/XI/083/Easy Revision - 2020 53 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
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
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. The Internet of Things (IoT) is a system of interrelated computing devices, mechanical and digital machines,
objects, animals or people that are provided with unique identifiers (UIDs) and the ability to automatically
transfer data over a network without requiring human-to-human or human-to-computer interaction.
20. Client–server model is a computing model where a device/software (called client) requests another
device/software (called server) to provide some services. The requested services are then provided by the
server to the client. In a client-server setup there can be multiple clients and multiple servers.
21. Cloud computing is the delivery of on-demand computing services over the Internet on a pay-as-you-go
basis. Three types of services provided on cloud are:
(i) SaaS: Software as a Service
(ii) IaaS: Infrastructure as a Service
(iii) PaaS: Platform as a Service
22. Advantages:
(i) Pay for what you use.
(ii) Better data security
Disadvantages/Limitations:
(i) Totally dependent on availability and speed of Internet connectivity.
(ii) More money is to be paid if more features are required.
23. Public cloud is a cloud service offered to multiple customers by a cloud provider. For example Microsoft
Azure is a public cloud.
24. A private cloud consists of computing resources used exclusively by one business or organization. The
private cloud can be physically located at the organization’s on-site data center, or it can be hosted by a
third-party service provider. Example – Cloud maintained by NIC (National Informatics Center).
25. Attenuation: Reduction in the strength of a signal during transmission. It happens when a signal travels
long distances over a network.
26. 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
27. Carrier waves are the electromagnetic waves (radio waves, micro waves, and infrared waves) which are
used as carriers of the data. Signals waves are the waves which represent the actual data to be carried.
28. Modulation: The process of mounting the data signals on carrier signals is called modulation.
Demodulation: The process of separating the data signals from carrier waves is called demodulation.
29. (i) FM signals give better quality than AM signals
(ii) AM signals can cover longer distances than FM signals.
(iii)The equipment requirements for FM system are costly as compared to that for AM system.
30. Collision in a network means two or more nodes simultaneously try to send the data on a common medium.
Performance of the network goes down due to collisions.
31. Collision prevention refers to ways to avoid collisions in a network. CSMA/CA protocol is used for collision
avoidance. Collision resolution refers to the process of resolving the collision, if there is any.

QB/XI/083/Easy Revision - 2020 54 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
32. A routing table is a table maintained in a router which is used to direct packets on networks. It maintains a
record of the routes to various network destinations. Routing tables may be specified by an administrator,
learned by observing network traffic or built with the assistance of routing protocols.

33. (i) Ping: It is a network tool used to provide a basic connectivity test between the requesting host and a
destination host. This is done by sending an echo packet to a destination host and listening for a response
from this host. Example: ping google.com

(ii) Traceroute (tracert): The tracert/traceroute utility is used to determine specific information about the
path to a destination host including the route the packet takes and the response time of these intermediate
hosts. Example: traceroute google.com

(iii) Ipconfig: This utility is used to find out and control the IP configuration information of a computer.

(iv) Nslookup: This utility is used to lookup the specific IP address(es) associated with a domain name. If
this utility is unable to resolve this information, there is a DNS issue.
Example: nslookup www.google.com returns 172.217.20.68

(v) WHOIS is a query and response protocol that is widely used for querying databases that store the
registered users or assignees of an Internet resource, such as a domain name, an IP address block or an
autonomous system, but is also used for a wider range of other information.

(vi) Speed test: A very easy test that can be used to both determine the Internet bandwidth available to a
specific host and to determine the quality of an Internet connection is the use of the tools available at the
speedtest.net and pingtest.net websites.

34. (a) ping (b) ping (c) traceroute (d) nslookup (e) whois (f) ipconfig (g) ipconfig (h) nslookup (i)
speedtest (j) speedtest

35.
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.
36. 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.

37. (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.

38. 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.
39. (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.
40. DNS (domain name system): It is a system of remote servers used to convert domain names to their
corresponding IP addresses.

QB/XI/083/Easy Revision - 2020 55 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/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)

QB/XI/083/Easy Revision - 2020 56 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
c) Satellite Link
d) Switch

(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

QB/XI/083/Easy Revision - 2020 57 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
b)

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

Society, Law, and Ethics


1. (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.
2. (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.
3. 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.
4. 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.
5. (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.
6. (a) Open source products include permission to use the source code, design documents, or content of the
product. It most commonly refers to the open-source model, in which open-source software or other
products are released under an open-source license as part of the open-source-software movement.

QB/XI/083/Easy Revision - 2020 58 © Yogesh Kumar


QB/XI/083/Easy Revision – 2020/Part-2
(b) Open data is the idea that some data should be freely available to everyone to use and republish as they
wish, without restrictions from copyright, patents or other mechanisms of control. The goals of the open-
source data movement are similar to those of other "open(-source)" movements such as open-source
software, hardware, open content, open education, open educational resources, open government, open
knowledge, open access, open science, and the open web.
(c) Privacy: Privacy refers to the ability to control what information one reveals about oneself over the
internet, and to control who can access that information.
7. Positive Impacts:
• Better connectivity using mobile phones, emails, social media etc.
• Paper saving due to paper-less offices.
Negative impacts:
• Health problems due to long hours of sitting in wrong posture
• Spread of wrong information through fake news on social media.
8. E-waste or electronic waste is the waste created when an electronic product is discarded after the end of its
useful life.
9. E-waste contains a lot of toxic chemicals. If not disposed of properly, E-waste can contaminate the
environment – the air, the water, and the soil.
10. (i) Upgrade to new device only when it is absolutely necessary
(ii) Donate old devices to some needy people who can use them.
11. (i) Give it to certified e-waste recycler.
(ii) Give back to the manufacturer/supplier at their drop off points.
12. Biometrics is the use of biological measurements, or physical characteristics, to identify individuals.
Biometrics include Fingerprint mapping, facial recognition, and retina scans are some of the most recognized
biometrics.
13. Advantages:
(i) Time saving: As biometrics devices are faster than human beings in recognize people and recording their
movement timings, use of biometrics saves a lot of time,
(ii) Accuracy: Biometrics devices record the data very accurately.
Disadvantages:
(i) Unhygienic: Touch based biometric devices may help in spread of diseases
(ii) Environment dependent: In extreme weather conditions, like in very high and very low temperatures,
biometric devices may not function accurately.
14. (i) While setting up school and college computer labs, in general, disabled students are not kept in mind. So,
they may find it inconvenient or impossible to use the computer labs.
(ii) Not much study material is available in the field for consumption by visually disabled students.
Effective handling of these issues:
(i) Computer labs should be made in such a way and at such places that all students can easily access. Labs
should be equipped with voice recognition system so that those who cannot type, can also do practical
learning.
(ii) Study material should be available in audio and braille forms also.
15. Data privacy is the relationship between the collection and dissemination of data, technology, the
public expectation of privacy, legal and political issues surrounding them. Data privacy is important to
prevent the misuse of data.
16. (i) Identity theft
(ii) fraud
(iii) spam
(iv) fraud
(v) hacking
17. (ii), (iii)
18. (ii), (iii)

QB/XI/083/Easy Revision - 2020 59 © Yogesh Kumar

You might also like