1 MARK QUESTIONS
Tokens- I mark questions
Write the full form of IDLE
Ans integrated development learning environment
Which of the following is not an assignment operator?
i.) **= ii.) /= iii.) == iv.)
%= Ans (iii) ==
Write the type of tokens from the following.
i. _Var ii. In
Ans (i) identifier (ii) operator-membership
operator
Find the correct identifiers out of the following, which can be
used for naming Variable, Constants or Functions in a python
program :
For, while, INT, NeW, del, 1stName, Add+Subtract, name1
Ans For, INT, NeW, name1
Find the correct identifiers out of the following,
which can be used for naming variable, constants
or functions in a python program :
While, for, Float, int, 2ndName, A%B, Amount2,
_Counter
Ans While, Float, _Counter, Amount2
Which of the following is valid logical operator
(i) && (ii) > (iii) and (iv) ==
Ans (iii) and
Write the data type of following literals:
(i) 123 (ii) True
Ans (i) number-integer (ii) Boolean
Which of the following is not a valid identifier name in Python?
Justify reason for it not being a valid name.
a) 5Total b) _Radius c) pi d)While
Ans (a) 5total-it starts with number (c) pi-is a keyword
Which of the following are valid operator in Python:
(i) */ (ii) is (iii) ^ (iv) like
Ans (ii) is-identity operator
Which of the following are Keywords in Python ?
(i) break (ii) check (iii) range (iv) while
Ans (i) break (iii) range (iv) while
Find the invalid identifier from the following
a) def b) For c)_bonus d)First_Name
Ans (a) def
Which of the following is valid arithmetic operator in Python:
(i) // (ii)? (iii) < (iv) and
Ans (i) //
Find the invalid identifier from the following
a) Subtotal b) assert c) temp_calc d) Name2
Ans (b) assert- it is a keyword
Which operator is used for replication?
a) + b) % c) * d) //
Ans (c) *
What is the value of the expression
4+4.00, 2**4.0
Ans (8.0, 16.0)
Identify the invalid keyword in Python from the following:
(a) True (b) None (c) Import (d) return
Ans (c) Import
Find the operator which cannot be used with a
string in Python from the following:
(a) + (b) in (c) * (d) //
Ans (d) //
Name the mutable data types in Python.
Ans : list,dictionary
Find the valid identifier from the following
a) My-Name b) True c) 2ndName d) S_name
Ans (d) S_name
Identify the valid logical operator in Python from the following.
a) ? b) < c) ** d) and
Ans (d) and
Which one is valid relational operator in Python
Which of the following can be used as valid variable identifiers
in Python?
a). / b). = c). = = d). and
Ans (c) ==
a) 4th Sum b) Total c) Number# d) _Data
Ans (b) Total (d) _Data
Identify the mutable data types?
(a) List (b) Tuple (c) Dictionary (d) String
Ans (a) List (c) Dictionary
Which of the following are valid operators in Python:
(a) ** (b) between (c) like (d) ||
Ans (a) **
Find the invalid identifier from the following
a) yourName b) _false c) 2My_Name d) My_Name
Ans (c) 2My_Name
Which of the following is a valid assignment operator in
Python ?
a) ? b) < c) *= d) and e) //
Ans (c) *=
Which of the following is not a valid identifier in
Python?
a) KV2 b) _main c) Hello_Dear1 d) 7 Sisters
Ans (d) 7 Sisters
Which of the following is valid relational operator in Python:
(a)// (b)? (c) < (d) and
Ans (c) <
Find the valid identifier from the following
a) False b) Ist&2nd c) 2ndName d) My_Name
Ans (d) My_Name
Identify the invalid logical operator in Python from the
following.
a) and b) or c) not d) Boolean
Ans (d) Boolean
Operators evaluation - I mark questions
Evaluate the following expressions:
a) 8/4+4**2//5%2-8 Ans -5.0
b) 10 >= 5 and 7 < 12 or not 13 == 3 Ans True
c) 6 * 3 + 4**2 // 5 8 Ans 13
d) 10 > 5 and 7 > 12 or not 18 > 3 Ans False
e) 18 % 4 ** 3 // 7 + 9 Ans 11
f) 2 > 5 or 5 == 5 and not 12 <= 9 Ans True
g) 6 * 3 + 4**2 // 5 8 Ans 13
h) 10 > 5 and 7 > 12 or not 18 > 3 Ans False
i) 51+4-3**3//19-3 Ans 51
j) 1718 and not 19==0 Ans True
k) 8 * 3 + 2**3 // 9 4 Ans 25
l) 12 > 15 and 8 > 12 or not 19 > 4 Ans False
m) not(20>6) or (19>7)and(20==20) Ans True
n) 17%20 Ans 17
o) 2 ** 3 ** 2 Ans 512
p) 7 // 5 + 8 * 2 / 4 3 Ans 2.0
If given A=2,B=1,C=3, What will be the output of following expressions:
(i) print((A>B) and (B>C) or(C>A)) Ans True
(ii) print(A**B**C) Ans 2
Write the output of the following python expression:
(a) print((4>5 and (2!=1) or (4<9)) Ans True
(b) print(2 + 3*4//2 - 4) Ans 4
(c) print(10%3 10//3) Ans -2
Module Identification- I mark questions
Name the Python Library modules which need to be imported to invoke the following functions:
(i) ceil() (ii) randrange() Ans (i) math (ii) random
(i) sin( ) (ii) randint ( ) Ans (i) math (ii) random
(i) sqrt() (ii) randint() Ans (i) math (ii) random
(i) dump() (ii) random() Ans (i) pickle (ii) random
(i) round() (ii) load() Ans (i) math (ii) pickle
(i) writerow() (ii) sqrt() Ans (i) csv (ii) math
(i) replace() (ii) load() Ans (i) string (ii) pickle
(i) cursor() (ii) pi Ans (i) mysql.connector (ii) math
(i) sin() (ii) reader() Ans (i) math (ii) csv
(i) cursor() (ii) reader() Ans (i) mysql.connector (ii) csv
i) stdin() ii) load() Ans (i) sys (ii) pickle
(i) log() (ii) writer() Ans (i) math (ii) csv
Which of the following functions generates an integer?
a) uniform( ) b) randint( ) c) random( ) d) None of the above Ans (b) randint()
Which module is used for working with CSV files in Python? Ans csv
Name the built-in function / method that is used to return the length of the object. Ans len()
Name the function/method required for
(a) Finding second occurrence of m in madam. Ans (a) index or find()
(b) Get the position of an item in the list Ans (b) find() or index ()
Observe the following Python code and write the name(s) of the header file(s), which will be
essentially required to run in a Python compiler.
X=randint(1,3)
Y=pow(X,3)
print(“hello”.upper()) Ans random,math,string
Name the built-in mathematical function / method that is used to return square root of a number
Ans sqrt()
Name the Python library module(s) which needs to be imported to run the following program:
print(sqrt(random.randint(1,16))) Ans math,random
Which of the following function is used to write data in binary mode?
a) write ( ) b) output ( ) c) dump ( ) d) send ( ) Ans (c) dump
String and List - I mark questions
Identify the valid declaration of P:
P= [‘Jan’, 31, ‘Feb’, 28]
a) dictionary b) string c)tuple d) list
Ans (d) list
Find the output
>>>A = [17, 24, 15, 30]
>>>A.insert( 2, 33)
>>>print ( A [-4])
Ans 24
Find the output of the following:
>>>Name = “Python Examination”
>>>print (Name [ : 8 : -1])
Ans noitanima
Given the lists Lst=[‘C’,’O’,’M’,’P’,’U’,’T’,’E’,’R’] ,
write the output of: print(Lst[3:6])
Ans PUT
What will be the output of following program:
a='hello'
b='virat'
for i in range(len(a)):
print(a[i],b[i])
Ans
h v
e i
l r
l a
o t
Give Output:
colors=["violet", "indigo", "blue", "green", "yellow",
"orange", "red"]
del colors[4]
colors.remove("blue")
colors.pop(3)
print(colors)
Ans ['violet', 'indigo', 'green', 'red']
If the following code is executed, what will be
the output of the following code?
name="Computer Science with Python"
print(name[2:10])
Ans mputer S
Given the list
Lst = [ 12, 34, 4, 56, 78, 22, 78, 89],
find the output of
print(Lst[1:6:2])
Ans [34,56,22]
Give the output of the following code:
L = [ 1,2,3,4,5,6,7]
B = L
B[3:5] = 90,34
print(L)
Ans [1, 2, 3, 90, 34, 6, 7]
Write the output of the following python
statements:
Array=[8,5,3,2,1,1]
print(Array[-1:-6:-1])
Ans 11235
Given the lists L=[1,3,6,82,5,7,11,92] ,
What will be the output of
print(L[2:5]) Ans [6,82,5]
Given the lists L=[“H”, “T”, “W”, “P”, “N”] ,
write the output of
print(L[3:4]) Ans [“P”]
Write the output of following code
t1 = [10, 12, 43, 39]
print(t1*3)
Ans
[10, 12, 43, 39, 10, 12, 43, 39, 10, 12, 43, 39]
Given the lists
L=[1,3,6,82,5,7,11,92] ,
write the output of
print(L[1:6])
Ans [3,6,82,5,7]
Identify the valid declaration of L:
L = [‘Mon’, ‘23’, ‘hello’, ’60.5’]
a). dictionary b). string c).tuple d). list
Ans (d) list
If the following code is executed, what will be the
output of the following code?
name="ComputerSciencewithPython"
print(name[3:10])
Ans puterSc
Which statement is not correct
a) The statement x = x + 10 is a valid
statement
What will be the output of following code snippet:
msg = “Hello Friends”
msg [ : : -1]
b) List slice is a list itself.
c) Lists are immutable while strings are
mutable.
d) Lists and strings in pythons support two
way indexing. Ans (c)
a) Hello b) Hello Friend
c) 'sdneirF olleH' d) Friend Ans (c)
Identify the valid declaration of L:
L = [1, 23, ‘hi’, 6]
(i)list (ii)dictionary (iii)array
(iv)tuple
Ans (i) list
A list is declared as
L=[(2,5,6,9,8)]
What will be the value of
print(L[0])?
Ans (2,5,6,9,8)
What will be the output when the following
code is executed
>>> str1 = “helloworld”
>>> str1[ : -1]
a). 'dlrowolleh' b).‘hello’
c).‘world’ d).'helloworl' Ans (a)
If the following code is executed, what will be the
output of the following code?
name="Kendriya Vidyalaya Class 12"
print(name[9:15])
Ans Vidyal
Given the lists
L=[1,30,67,86,23,15,37,131,9232] , write the
output of
print(L[3:7]) Ans [86, 23, 15, 37]
A list is declared as
Lst = [1,2,3,4,5,6,8]
What will be the value of sum(Lst)? Ans 29
Identify the valid declaration of L:
L = (‘Mon’, ‘23’, ‘hello’, ’60.5’)
a). dictionary b). string c). tuple d). list
Ans (c)
If the following code is executed, what will be the
output of the following code?
name="Computer_Science_with_Python"
print(name[-25:10])
Ans puter_S
How many times is the word ‘hello’ printed in
the following statement?
S=’python rocks’
for ch in s[3:8]:
print(‘hello’)
(i) 5 (ii) 6
(iii) 7 (iv) 4 Ans (i)
Given the list
L=[1,3,6,82,5,7,11,92],
write the output of
print(L[1:4:2]
Ans [3,82]
Given the string
x="hello world", write the output of
print(x[:2],x[:-2])
Ans he hello wor
Identify the correct option to print the value 80 from
the list
L=[10,20,40,80,20,5,55]
(i) L[80] (ii) L[4] (iii) L[L] (iv) L[3]
Ans (iv) L[3]
if a=[5,4,3,2,2,2,1],
evaluate the following expression:
print( a[a[a[a[2]+1]]])
Ans 2
Give the output of the following:
x="Marvellous"
print( x[2:7], "and" , x[-4:-1] )
Ans rvell and lou
What is the output produce by the
following code?
alst=[1,2,3,4,5,6,7,8,9]
print(alst[: :3])
Ans [1, 4, 7]
Is there any difference in ‘a’ or “a” in python?
Ans. No
A string with zero character is called __________
string
Ans empty string
Is there any difference between 1 or ‘1’ in
python?
Ans. Yes
Python does not support a character type.(T/F)
Ans True. (Python supports string type)
Write a code to create empty string 'str1' Ans. str1 = ' '
What do you mean by traversing a string?
Ans. Traversing a string means accessing all the elements of the string one by one by using
index value.
What is the index value of first element of a string? Ans. 0
What is the index value of last element of a string? Ans. -1
If the length of the string is 10 then what would be the positive index value of last element?
Ans. 9
If the length of string is 9, what would be the index value of middle element? 9 Ans. 4
Index value of a string can be in float. (T/F) Ans. False
What type of error is returned by following statement, if the length of string 'str1' is 10.
print(str1[13]) Ans. Index error
Tuple: 1 mark Questions
A tuple is declared as
t1=(1,2,3,3,5,6,5,6,7,3,8,9)
what will be the value of
print(t1.count(3))
Ans 3
Find the output from the following
code:
t=tuple()
t=t+(‘Python’,)
print(t)
print(len(t))
ans
(‘Python’,)
1
Suppose a tuple T is declared as
T = "Yellow", 20, "Red"
a, b, c = T
print(a)
which of the following is correct?
(a) (‘Yellow’, 20, ‘Red’)
(b) TypeError
(c) Yellow
Ans (c)“Yellow”
Choose the correct way to access
value 20 from the following tuple
aTuple = ("Orange", [10, 20, 30], (5, 15, 25))
a) aTuple[1:2][1]
b) aTuple[1:2](1)
c) aTuple[1][1]
Ans (c) aTuple[1][1]
Suppose a tuple T is declared as
T = (10, 12, 43, 39),
which of the following is Incorrect?
a) print(T[1]) b) print(max(T))
c) print(len(T)) d) None of the above
Ans (d)
Suppose a tuple T1 is declared as
T1 = (10, 20, 30, 40, 50)
which of the following is incorrect?
a) print(T[1]) b) T[2] = -29
c) print(max(T)) d) print(len(T))
Ans (b)
Suppose a tuple T is declared as
T = (10, 12, 43, 39),
which of the following is incorrect?
a) print(T[1]) b) T[3] = 9
c) print(max(T)) d) print(len(T))
Identify the data type of X:
X = tuple(list( (1,2,3,4,5) ) )
a)Dictionary (b) string (c) tuple (d) list
Ans tuple
Ans (b) because tuple is immutable.
A tuple is declared as
T = (20,5,16,29,83)
What will be the problem with the code
T[1]=100.
Ans It will show error tuple is immutable.
Suppose a tuple T is declared as
T = (10, 20, 30, 40),
what will be the output of
print(T*2)
Ans 20,40,60,80
t1=(2,3,4,5,6)
print(t1.index(4))
output is
a). 4 b). 5 c). 6 d). 2 Ans (d) 2
What is the length of the tuple shown below?
t=(((('a',1),'b','c'),'d',2),'e',3)
Ans 3
A tuple is declared as T = (2,5,6,9,8)
What will be the value of sum(T)? Ans 30
Which of the following statements will create
a tuple ?
(a) Tp1 = (“a”, “b”) (b) Tp1= (3) * 3
(c) Tp1[2] = (“a”, “b”) (d) None of these
Ans (a)
Find the output of the following:
>>>S = 1, (2,3,4), 5, (6,7)
>>> len(S)
Ans 4
Identify the valid declaration of Rec:
Rec=(1,‟Vikrant”,50000)
(i)List (ii)Tuple
(iii)String (iv)Dictionary
Ans (ii) Tuple
A tuple is declared as
T = (1,2), (1,2,4), (5,3)
What will be the value of min(T) ? Ans (1,2)
Consider the tuple in python named
DAYS=(”SUN”,”MON”,”TUES”)
Identify the invalid statement(s) from the
given below statements:
a). S=DAYS[1] b). print(DAYS[2])
c). DAYS[0]=”WED d). LIST=list(DAYS)
Ans (c) DAYS[0]=”WED”
Suppose a tuple Tup is declared as
Tup = (12, 15, 63, 80),
which of the following is incorrect?
a) print(Tup[1]) b) Tup[2] = 90
c) print(min(Tup)) d) print(len(Tup))
Ans (b) Tup[2]=90
What is the output of the following code:
for i in range(-3,4,2):
print(i, end = '$')
Ans -3$-1$ 1$ 3$
If a is (1, 2, 3), what is the difference (if any) between
a*3 and [a, a, a]?
Ans:
a*3 is different from [a,a,a] because, a*3 will
produce a tuple (1,2,3,1,2,3,1,2,3) and [a, a, a]
will
produce a list of tuples [(1,2,3),(1,2,3),(1,2,3)].
If a is (1, 2, 3), is a *3 equivalent to a + a+ a?
Ans yes
Does a slice operator always produce a new Tuple?
Ans:
Yes
How is an empty Tuple created?
Ans:
T
=()
or
T=tuple()
How is a tuple containing just one element created?
Ans:
T=3,
or
T=(4,)
What is the difference between (30) and
(30,)?
Ans:
(30) is an integer while (30,) is a tuple
Predict the output
G=’a’,’b
H=(‘a’,’b’)
print(G==H) Ans True
Predict the output
T=(1,)*3
T[0]=2
print(T)
Ans typeError. Tuple is immutable so can’t
do changes
Find output
(a,b,c)=(1,2,3)
Ans this will assign 1 to a , 2 to b and 3 to c
Find output
a,b,c,d=(1,2,3)
Ans Error becoz not enough values to
pack(expected 4, got 3)
Find output
a, b, c, d, e = (p, q, r, s, t) = t1
Ans If tuple t1 has 5 values then this will assign first
value of t1 in to a and p , next value to b
and q and
so on.
How can you add an extra element to a
tuple?
Ans T=T+(9,)
Which of the following will create a tuple x?
(a) x = (1) (b). x = (1,)
(c) . x = {1} (d) None of the above Ans (b)
What is the output of following line of code ?
x= (2, 1, 4)
print(len(x)) Ans 3
What is the output of following line of code?
x,y, z = (3.3, 4.1, 2.2)
print(x) Ans 3.3
What is the output of following line of code?
x,_, z = (3.3, 4.1, 2.2)
print(_) Ans 4.1
What is the output of following line of code ?
_,_ = (3.3, 4.1, 2.2)
print(_) Ans Error
What is the output of following line of code ?
x = (3.3, 4.1, 2.2) *2
print(x)
Ans (3.3, 4.1, 2.2, 3.3, 4.1,2.2)
What is the output of following line of code?
x = (3.3, 3.3, 4.1, 4.1, 2.2, 2.2)
print(x.index(3.3)) Ans 0
What is the output of following line of code?
x = (3.3, 3.3, 4.1, 4.1, 2.2, 2.2)
print(x[0::2] == x[1::2]) Ans True
Which of the following method will not work with
Python tuple object?
a). sort() b). count()
c). index() d). None of the above Ans (a)
Dictionary: 1 mark Questions
What will be the result of the following code?
>>>d1 = {“abc” : 5, “def” : 6, “ghi” : 7}
>>>print (d1[0])
(a) abc (b) 5 (c) {“abc”:5} (d) Error Ans (d) Error
Which of the following statement create a dictionary?
a) d = { }
b) d = {“john”:40, “peter”:45}
c) d = (40 : “john”, 45 : “peter”}
d) All of the above Ans (d) all of the above
Which statement is correct for dictionary?
(i) A dictionary is a ordered set of key:value pair
(ii) each of the keys within a dictionary must be unique
(iii) each of the values in the dictionary must be unique
(iv) values in the dictionary are immutable
Ans (ii) each of the keys within a dictionary must be unique
Which is the correct form of declaration of dictionary?
(i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday]
(iv) Day={1’monday’,2’tuesday’,3’wednesday]
Ans (i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
Declare a dictionary in python named QUAD having Keys(1,2,3,4) and
Values(“India”,”USA”,”Japan”,”Australia”)
Ans QUAD={1:”India”, 2:”USA”, 3:”Japan”, 4:”Australia”}
Write a statement in Python to declare a dictionary whose keys are 1,2,3 and values are Apple, Mango
and Banana respectively.
Ans Dict={1:’Apple’, 2: ’Mango’,3 : ‘Banana’}
Given
employee={'salary':10000,'age':22,'name':'Mahesh'}
employee.pop('age')
what is output
print(employee) Ans {'salary':10000,'name':'Mahesh'}
Write the ouput of following code:
d={'amit':19,'vishal':20}
print(d.keys()) Ans dict_keys(['amit', 'vishal'])
What will be output of following:
d = {1 : “SUM”, 2 : DIFF”, 3 : “PROD”}
for i in d:
print (i)
b) SUM
DIFF
PROD
c) 1
SUM
2
DIFF
3
PROD
d) 3
SUM
3
DIFF
3
PROD
Ans (a)
Write a statement in Python to declare a dictionary whose keys are ‘Jan’, ’Feb’, ’Mar’ and values are
31, 28 and 31 respectively.
Ans Month={‘Jan’:31,’Feb’:28,’Mar’:31}
Write a statement in Python to declare a dictionary whose keys are 5, 8, 10 and values are May, August
and October respectively.
Ans Dict= {5:"May", 8: "August", 10: "October"}
Write a code to add the following key-value to a given dictionary.
A={‘class’:’VI’, ‘Sec’:’B’,’Rollno’:1}
Key
Value
Fee
Done
Route
AB
Ans
A["Fee"]="Done"
A["Route"]="AB"
Which of the following is the correct form of using dict()?
a) dict([('a' , 45), ('b', 78)])
b) dict({'a' : 45, 'b' :78})
c) dict('a'=45, 'b'=78)
d) All of these Ans (d)
a={1:10,2:20,3:30}
(a) Write code to delete the second element using del command. Ans del(a[2])
(b) Write code to delete the third element using pop() function. Ans a.pop(3)
MySQL- 1 mark questions
Which command is used to change the number of
columns in a table? Ans ALTER
Which keyword is used to select rows containing
column that match a wildcard pattern? Ans LIKE
Differentiate between Degree and Cardinality.
Ans Degree it is the total number of columns in
the table.
Cardinality it is the total number of tuples/Rows
in the table.
All aggregate functions except ___________
ignore null values in their input collection.
a) Count (attribute) b) Count (*)
c) Avg () d) Sum ()
Ans count(*)
Group functions can be applied to any numeric
values, some text types and DATE values.
(True/False)
Ans True
Which command is used to change the existing
information of table?
Ans update
Expand the term: RDBMS
Ans Relational Database Management System
Write an Aggregate function that is used in
MySQL to find No. of Rows in the database Table
Ans count(*)
For each attribute of a relation, there is a set of
permitted values, called the of that attribute.
a). Dictionaries b). Domain
c). Directory d). Relation
Ans (b) Domain
In SQL, write the query to display the list of
databases stored in MySQL.
Ans show databases
Which is not a constraint in SQL?
a) Unique b) Distinct c) Primary key d) check
Ans (b) Distinct
Which command is used to see the structure of
the table/relation.
a) view b) describe
c) show d) select
Ans (b) describe
A virtual table is called a .............
Ans view
Which clause is used to remove the duplicating
rows of the table?
i) or ii) distinct iii) any iv)unique
Ans (ii) distinct
Which clause is used in query to place the
condition on groups in MySql?
i) where ii) having
iii) group by iv) none of the above
Ans (ii) having
Which command is used for counting the number
of rows in a database?
i) row ii) count
iii) rowcount iv) row_count
Ans rowcount
A Resultset is an object that is returned when a
cursor object is used to query a table. True/False
Ans True
In SQL, name the clause that is used to place
condition on groups
Ans Having
In SQL, which command is used to change the
structure of already created table.
Ans Alter table
Which operator performs pattern matching in
SQL?
Ans Like
What does the following function result into?
count(field_name)
Ans It returns the number of non-null records
from the field.
In SQL, what are aggregate functions?
Ans These functions work with data of multiple
rows at a time and return a single value.
How many Primary and Foreign keys can a table
have?
Ans Primary Key 1 Foreign Key Many
In SQL, write the name of the aggregate function
which is used to calculate & display the average
of numeric values in an attribute of a relation.
Ans AVG()
Write an SQL query to display all the attributes of
a relation named “TEST” along with their
description.
Ans DESCRIBE TEST; or DESC TEST;
What is the use of LIKE keyword in SQL?
Ans LIKE keyword is used to find matching CHAR
values with WHERE clause.
Which of the following is NOT a DML command?
a). SELECT b). DELETE
c). UPDATE d). DROP
Ans (d) DROP
What is the purpose of following SQL command:
SHOW DATABASES;
Ans This command will print name of all the
databases present in RDBMS.
Identify the error in the following SQL query
which is expected to delete all rows of a table
TEMP without deleting its structure and write the
correct one:
DELETE TABLE TEMP;
Ans DELETE FROM TEMP;
In SQL, name the command/clause that is used to
display the rows in descending order of a column.
Ans Order By …… Desc
In SQL, what is the error in following query :
SELECT NAME, SAL, DESIGNATION WHERE
DISCOUNT=NULL;
Ans SELECT NAME,SAL,DESIGNATION WHERE
DISCOUNT IS NULL;
Write any two aggregate functions used in SQL.
Ans max(),min(),avg(),count()
Which of the following is a DML command?
a) SELECT b) Update
c) INSERT d) All
Ans (d) All
In SQL, write the query to display the list of
databases.
Ans SHOW DATABASES’
Which of the following will suppress the entry of
duplicate value in a column?
a) Unique b) Distinct
c) Primary Key d) NOT NULL
Ans (b) Distinct
A non-key attribute, whose values are derived
from primary key of some other table.
a). Alternate Key b). Foreign Key
c). Primary Key d). Candidate Key
Ans (b) foreign Key
Identify the DDL Command.
(i) Insert into command (ii) Create table
command (iii) Drop table Command (iv) Delete
command
Ans (ii) Create table command (iii) Drop table
Command
Which clause is used with a SELECT command in
SQL to display the records in ascending order of
an attribute?
Ans Order by
A relation has 45 tuples & 5 attributes, what will
be the Degree & Cardinality of that relation?
a). Degree 5, Cardinality 45
b). Degree 45, Cardinality 5
c). Degree 50, Cardinality 45
d). Degree 50, Cardinality 2250
Ans (a) Degree 5, Cardinality 45
In SQL, which aggregate function is used to count
all records of a table?
Ans count(*)
Anita is executing sql query but not getting the
appropriate output, help her to do the
correction.
Select name from teacher where subject=Null;
Ans Select name from teacher where subject is
Null;
Sunita executes following two statements but got
the variation in result 6 and 5 why?
(i) select count(*) from user ;
(ii) select count(name) from user ;
Ans
Count(*) will count rows where as
count(name) will count name column only which
is having one null value.
What is the difference between where and
having in SQL.
Ans Where is used apply condition in query,
where as having is used only with group.
Write a command to add new column marks in
table ‘student’ data type int.
Ans Alter table student add marks int(3)
Write query to display the structure of table
teacher.
Ans describe teacher or desc teacher
In SQL, what is the use of BETWEEN operator?
Ans The BETWEEN operator selects values within
a given range
In SQL, name the clause that is used to display
the tuples in ascending order of an attribute.
Ans Orderby
In SQL, what is the use of IS NULL operator?
Ans To check if the column has null value / no
value
Write any one aggregate function used in SQL.
Ans SUM / AVG / COUNT / MAX / MIN
Which of the following is a DDL command?
a) SELECT b) ALTER
c) INSERT d) UPDATE
Ans (b) ALTER
In SQL, write the query to display the list of tables
stored in a database
Ans Show tables;
Which of the following types of table constraints
will prevent the entry of duplicate rows?
a) check b) Distinct
c) Primary Key d) NULL
Ans (c) Primary Key
Which is known as range operator in MySQL.
a) IN b) BETWEEN
c) IS d) DISTINCT
Ans (b) BETWEEN
If column “salary” of table “EMP” contains the
dataset {10000, 15000, 25000, 10000, 25000},
what will be the output of following SQL
statement?
SELECT SUM(DISTINCT SALARY) FROM EMP;
a) 75000 b) 25000
c) 10000 d) 50000
Ans (d) 50000
Which of the following functions is used to find
the largest value from the given data in MySQL?
a) MAX ( ) b) MAXIMUM ( )
c) LARGEST ( ) d) BIG ( )
Ans (a) MAX()
Name the clause used in query to place the
condition on groups in MySQL?
Ans having
Write SQL statement to find total number of
records in table EMP?
Ans count(*)
Write command to list the available databases in
MySQL.
Ans show databases
In SQL, name of the keyword used to display
unique values of an attribute.
Ans DISTINCT
In SQL, what is the use of ORDER BY clause ?
Ans To display the values in sorted order
Write the function used in SQL to display current
date
Ans curdate()
Which of the following is a DML command?
a) CREATE b)ALTER c) INSERT d) DROP
Ans (c) insert
In SQL, write the command / query to display the
structure of table ‘emp’ stored in a database.
Ans desc emp
Which of the following type of column
constraints will allow the entry of unique and not
null values in the column?
a) Unique b) Distinct
c) Primary Key d) NULL
Ans (c) Primary Key
In SQL, name the clause that is used to display
the unique values of an attribute of a table.
Ans distinct
In SQL, what is the use of <> operator?
Ans not equal to
Write any two aggregate function used in SQL
Ans max/min/avg/sum/count(*)
Which of the following is/ are DML command(s)?
a) SELECT b) ALTER
c) DROP d) UPDATE
Ans (a) select (d) update
In SQL, write the query to display the list
databases.
Ans show databases
Which of the following types of table constraints
will not prevent NULL entries in a table?
a) Unique b) Distinct
c) Primary Key d) NOT NULL
Ans (c) Primary Key
Rearrange the following transmission media in
increasing order of data transfer rates.
UTP CAT - 5 , UTP CAT 6, IR, Bluetooth, OFC
Ans IR, Bluetooth, UTP CAT - 5, UTP CAT 6, OFC
Networking 1 mark Questions
_______________ is a network device that
connects dissimilar networks.
Ans Gateway
Give one example of each Guided media and
Unguided media
Ans Guided Twisted pair, Coaxial Cable, Optical
Fiber (any one)
Unguided Radio waves, Satellite, Micro Waves
(any one)
Ravi received a mail from IRS department on
clicking “Click –Here”, he was taken to a site
designed to imitate an official looking website,
such as IRS.gov. He uploaded some important
information on it
Ans Phishing
__________ is a specific condition in a network
when more data packets are coming to network
device than they can handle and process at a
time. Ans Network Congestion
Name the protocol that is used to transfer file
from one computer to another.
Ans FTP
Raj is a social worker, one day he noticed
someone is writing insulting or demeaning
comments on his post. What kind of Cybercrime
Raj is facing?
Ans Identity Theft
Name the Transmission media which consists of
an inner copper core and a second conducting
outer sheath.
Ans Co-axial cable
Write the expanded form of GPRS?
Ans General Packet Radio Service (GPRS)
Define Bandwidth?
Ans a band of frequencies used for sending
electronic signals
--------------describe the maximum data transfer
rate of a network or Internet connection.
Ans Bandwidth
Mahesh wants to transfer data within a city at
very high speed. Write the wired transmission
medium and type of network.
Ans Wired transmission medium Optical fiber
cable
Type of network MAN.
What is a Firewall in Computer Network?
A). The physical boundary of Network
B). An operating System of Computer Network
C). A system designed to prevent unauthorized
access
D). A web browsing Software
Ans
C). A system designed to prevent unauthorized
access.
Which of the following is not done by cyber
criminals?
a) Unauthorized account access
b) Mass attack using Trojans as botnets
c) Report vulnerability in any system
d) Email spoofing and spamming
Ans (c) Report vulnerability in any system
Name the wired transmission media which has a
higher bandwidth. Ans Optical Fiber
Name the network device that connects
dissimilar networks.
Ans Gateway
Arrange the following media in decreasing order
of transmission rates.
Twisted Pair Cables, Optical Fiber, Coaxial Cables.
Ans Optical Fiber, Coaxial Cables, Twisted Pair
Cables
Name the protocol used for remote login.
Ans TELNET
Website incharge KABIR of a school is handling
downloading/uploading various files on school
website. Write the name of the protocol which is
being used in the above activity.
Ans FTP
What is its use of Data encryption in a network
communication?
Ans Data encryption is the process of converting
a message into an unmeaningful form. It is used
to ensure data security while communication.
Give the full form of the following:
(a) URL (b) TDMA
Ans
(a) URL Uniform Resource Locator
(b)TDMA Time Division Multiple Access
Differentiate between Bps & bps.
Ans Bps is Byte per second and
bps is bits per second which tells the variation in
data transmission speed.
Identify the Guided and Un-Guided Transmission
Media out of the following:
Satellite, Twisted Pair Cable, Optical Fiber, Infra-
Red waves
Ans Guided: Twisted Pair Cable, Optical Fiber
Unguided: Satellite, Infra-Red waves
Protocol is used to send email …………
Ans SMTP (simple mail transfer protocol)
Your friend Sunita complaints that somebody has
created a fake profile on Twitter and defaming
her character with abusive comments and
pictures. Identify the type of cybercrime for these
situations.
Ans Identity Theft
Name the transmission media best suitable for
connecting to desert areas.
Ans microwave
Write the expanded form of VPN.
Ans Virtual Private Network
Rearrange the following terms in increasing order
of speedy medium of data transfer.
Telephone line, Fiber Optics, Coaxial Cable,
Twisted Paired Cable
What is Telnet?
Ans Telnet is an internet utility that lets us log on
to a remote computer system. A user is able to
log in the system for sharing of files without
being the actual user of that system
Ans Telephone line, Twisted Pair Cable, Coaxial
Cable, Fiber Optics
State whether the following statements is True or
False. When two entities are communicating and
do not want a third party to listen, this situation
is defined as secure communication.
Ans True
Expand the term a). XML b). SMS
Ans
(a) XML-Extensible Markup Language
(b) SMSShort Messaging Service
Name two web scripting languages
Ans VBScript, JavaScript, ASP, PHP, PERL and JSP
Which of these is not an example of unguided
media?
(i) Optical Fibre Cable (ii) Radio wave
(iii) Bluetooth (iv) Satellite
Ans Optical Fiber( guided media or wired media)
What is HTML?
Ans HTML (Hyper Text Markup Language) is used
to create Hypertext documents (web pages) for
websites.
Name the protocol that is used to upload and
download files on internet.
Ans FTP or HTTP
Your friend kaushal complaints that somebody
accessed his mobile device remotely and deleted
the important files. Also he claims that the
password of his social media accounts were
changed. What crime was Manoj a victim of? Also
classify the crime on basis of it’s intent (malicious
/ non-malicious).
Ans The gaining of unauthorized access to data in
a system or computer is termed as hacking. It can
be classified in two ways: (i) Ethical Hacking
(ii)Cracking
Which is not a network topology?
a)BUS b). STAR
c). LAN d). RING
Ans (c) LAN
Which of the following appears harmless but
actually performs malicious functions such as
deleting or damaging files.
(a) WORM (b)Virus
(c) Trojan Horse (d)Malware
Ans (c) Trojan Horse
Name the protocol that is used to send emails.
Ans SMTP
Your friend Ranjana complaints that somebody
has created a fake profile on Facebook and
defaming her character with abusive comments
and pictures. Identify the type of cybercrime for
these situations.
Ans Cyber Stalking / Identity theft
Name The transmission media best suitable for
connecting to hilly areas
Ans microwave/radiowave
Write the expanded form of Wi-Fi.
Ans Wireless-Fidelity
TCP/IP stands for-
Ans Transmission Control Protocol/Internet
Protocol
An attack that encrypts files in a computer and
only gets decrypted after paying money to the
attacker.
a) Botnet b) Trojan
c) Ransomware d) Spam
Ans (c) Ransomware
Write the name of topology in which all the
nodes are connected through a single Coaxial
cable?
Ans BUS totplogy
Write full form of VoIP.
Ans voice over internet protocol
Expand the term DHCP.
Ans Dynamic Host Configuration Protocol
Name the protocol that is used for the transfer of
hypertext content over the web.
Ans HTTP
In a Multi-National company Mr. A steals Mr. B’s
intellectual work and representing it as A’s own
work without citing the source of information,
which kind of act this activity be termed as?
Ans Plagiarism
Give at least two names for Guided and Unguided
Transmission Media in networking.
Ans Guided Media: Twisted pair Cable, Coaxial
Cable , Fiber Optic Cable
Unguided Media: Microwave / Radio wave ,
Infrared, Satellite
Write the expanded form of Wi-Fi and GSM
Ans
WiFi : Wireless Fidelity
GSM : Global System for Mobile Communication
Rearrange the following terms in increasing order
of data transfer rates.
Gbps, Mbps, Tbps, Kbps, bps
Ans bps, Kbps, Mbps, Gbps, Tbps
Name the protocol that is used to transfer files.
Ans FTP
Your friend’s mother receives an e-mail to access
the additional services of bank at zero cost from
some agency asking her to fill her bank details
like credit card number and PIN in the form
attached to the mail. Identify the type of
cybercrime in this situation
Ans phishing
Name the fastest available transmission media.
Ans Optical Fibre cable( OFC)
Write the expanded form of LAN & MAN.
Ans
Local Area Network .
Metropolitan Area Network