0% found this document useful (0 votes)
72 views

Xii CS QB 2024-25

Computer science
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)
72 views

Xii CS QB 2024-25

Computer science
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/ 91

A

केंद्रीय विद्यालय संगठन, भोपाल संभाग


KENDRIYA VIDYALAYA SANGATHAN, BHOPAL REGION
सत्र २०२४-२०२५

COMPUTER SCIENCE (083)


OUR PATRONS

Shri. Dr. R. Senthil Kumar


Deputy Commissioner KVS RO, Bhopal

Smt. Rani Dange


Asst. Commissioner KVS RO, Bhopal

Smt. Kiran Mishra


Asst .Commissioner KVS RO, Bhopal

Smt. Nirmala Budania


Asst. Commissioner KVS RO, Bhopal

Shri. Vijay Vir Singh


Asst. Commissioner KVS RO, Bhopal
Unit Page
No. Unit Name Topic No.

Rev. Tour (Python Basics [Data Types + Operators


etc], Conditional Statements, Looping)

Rev. Tour (String, List, Tuple, Dictionary)


Computational
1 Thinking &
Programming -
2 Intro to Python Modules + Working with Functions

Exception Handling + File Handling

Computer Computer Networks


2 Networks

Database
3
Management Database Management
Content Coordinators
Shri Rajesh Sahu, Principal
PMSHRI Kendriya Vidyalaya Hoshangabad

Smt. Sangeeta M Chauhan Smt. Kirti Asrekar


PGT (Comp. Sc.) PGT (Comp. Sc.)
PM SHRI Kendriya Vidyalaya PMSHRI Kendriya Vidyalaya
No. 3 Morar Cantt, Gwalior Seoni Malwa

Content Creators
Name of K.V. Name of P.G.T. (Comp. Sc.)
Tikamgarh Mrs. Monika Verma
IIT Indore Mr. Deepak Bhinde
Mungaoli Mr. Vijendra Rathore
Indore No. 1(Shift I) Mr. Kamal Kishore Sharma
Itarsi CPE Mrs. Hemlata Soni
Itarsi OF Mr. Vikas Mehsram
No. 1 Bhopal Mr. Manoj Kumar Verma
No. 5 Gwalior Mr. Mohan Dixit
No. 1 Gwalior (Sh 1) Mrs. Varsha Saxena
No. 1 Gwalior (Sh 2) Mr. Vinayak Soni
Jhabua Mr. Vinay Kumar Kaushik
Morena Mr. Hansraj Saini
ITBP Shivpuri Mr. Abhishek Arya
Bhind Mr. Mahendra Pratap Singh
Rajgarh Mr. Rajesh Kumar Meena
Sarni Mr. Manoj Kumar Ahirwar
Cover Page Design
No.3 Gwalior Mrs Sangeeta M Chauhan

Final Design and Compilation


Mhow Mrs. Manisha Dubey
Mungaoli Mr. Vijendra Rathore
Dhar Mrs. Manisha Malviya
Indore No. 1(Shift I) Mr. Kamal Kishore Sharma
INDEX
Unit Page
No. Unit Name Topic No.

Python Revision Tour class XI 1

Intro to Python Modules + Working with Functions 13


Computational
1 Thinking &
Programming
-2 Exception Handling + File Handling 23

Data Structure
35

Computer
2 Computer Networks
Networks 40

Database
3
Management Database Management 70
PYTHON REVISION TOUR CLASS XI
Topic Tokens Ma
Description: Smallest individual unit of a program is called token rks
Example : Variable, Literal, Keyword etc.
Q.1 How many tokens are in the following code: 1
c = a+b
Ans: Tokens : c, =, a, +, b
Q.2 Write the type of tokens from the following 1
(i) If (ii) roll_no
Ans: (i) Keyword, (ii) Variable
Topic Keyword : Any reserved word in Python.

Example: if, for, print etc.


Q.3 Which one of the following is not a keyword: 1
a. print, b. ‘hello’, c. if, d. for
Ans: ‘hello’
Topic Variable: Named storage location

a=5
where a is a variable.
Q.4 Which one is legal variable : 1
a. _abc, b. 1sa, c. ss dd, d. si@32
Ans: a. _abc
Topic Conditional Statements:
Statements that are used to define conditions.

if, if else, if elif else etc.

Q.5 Write a program to check whether a number is even or odd. 2


Ans: a = int(input(“enter a number”))
if a%2 == 0:
print(“even”)
else
print(“odd”)
Q.6 Write a program to check whether a person is eligible for voting or not. 2
Ans: a = int(input(“enter age”))
if a >= 18:
print(“eligible”)
else
print(“not eligible”)
Q.7 Write correct code after correction in following code: 2
a=5
b = 10
If a=5:
print(a)
else
pg. 1
Print(b)
Ans: a=5
b = 10
if a==5:
print(a)
else:
print(b)

Topic Loop: Execution of Same lines of code multiple times.

Types of loops: for loop, while loop

Example: for a in range(1,5,1):


print(a)
This code is displaying natural number from 1 to 5 using for loop.

i=1
while i<=5:
print(i)
i = i+1
This code is displaying natural number from 1 to 5 using while loop.

Q.8 What is range function ? 1


Ans: Range functions returns values between given range.
Q.9 Write a program to display even number between 1 to 20 using for loop. 2
Ans: for i in range(2,21,2):
print(i)
Q.10 Write a program to display odd numbers between 1 to 20 using while loop. 2
Ans: i=1
while i<=20
print(i)
i = i+2
Q.11 How many times will the following loop execute ? 2
for i in range(1,3,1):
for j in range(i+1):
print(“*”)
Ans: 5 Times
Topic Expressions: Combination of operators and operands is called expression
Q.12 What will be the output of following expressions: 2

(i) 5/2 (ii) 9//2


Ans: (i) 2.5 (ii) 4
Data Type: Type of data is defined by datatype.

Example: Integer: 1, 40
Float : 2.5
pg. 2
String : “Hello”
Boolean : True, False
Q.13 Write the datatype of following literals: 2
(i) 50.7 (ii) “India”

Ans: (i) Float, (ii) String


Q.14 Write the datatype of following literals: 3
(i) 100 (ii) False
Ans: (i) Integer, (ii) Boolean
Q.15 Name any 2 data types of Python 1
Ans: Boolean, String
15 Questions Assertion and Reasoning (Revision Tour Class XI)
ASSERTION AND REASONING based questions. Mark the correct
choice as:
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
Q.1 Assertion : (A) Variable is a stored location that can change its value. 1
Reasoning : (B) Given a = 5, a is variable and 5 is literal.
Ans: (a)
Q.2 Assertion : (A) Data Types define Type of Data. 1
Reasoning : (B) Token is the smallest individual unit in a program.
Ans: (b)
Q.3 Assertion : (A) A loop is used to repeat a task. 1
Reasoning : (B) if is used to define conditions.
Ans: (b)
Q.4 Assertion : (A) Jump statements are used to come out of loop.
Reasoning : (B) break is used to send control out of the loop.
Ans: (a)
Q.5 Assertion : (A) Jump statements are used to come out of loop. 1
Reasoning : (B) break is used to send control out of the loop.
Ans: Assertion : (A) Variable name may have only underscore in it.
Reasoning : (B) simple_interest is name of variable.
Ans: (a)
Q.6 Assertion : (A) List is represented using square bracket. 1
Reasoning : (B) a = [1,2,3,45], where a is list.
Ans: (a)
Q.7 Assertion : (A) Variable name may have only underscore in it. 1
Reasoning : (B) simple_interest is name of variable.
Ans: (a)
Q.8 Assertion : (A) Dictionary is combination of keys and values. 1
Reasoning : (B) Keys are immutable and values are mutable.
Ans: (b)
Q.9 Assertion : (A) String is immutable. 1
Reasoning : (B) a = “hello”, a[0] = ‘f’ is not possible.
Ans: (a)
pg. 3
Q.10 Assertion : (A) String is immutable. 1
Reasoning : (B) a = “hello”, a[0] = ‘f’ is not possible.
Ans: (a)
Q.11 Assertion : (A) We can assign same value in multiple variables. 1
Reasoning : (B) a =b=c=10, here value of a, b and c is 10.
Ans: (a)
Q.12 Assertion : (A) Empty statement defined using pass statement. 1
Reasoning : (B) if statement is used to define condition.
Ans: (b)
Q.13 Assertion : (A)“””A sample Python String””” is a valid Python string. 1
Reasoning : (B) Triple quotation marks are not valid in Python.
Ans: (c)
Q.14 Assertion : (A)The break statement can be used with all selection and iteration 1
statements.
Reasoning : (B) Using break with an if statement will give no error.
Ans: (d)
Q.15 Assertion : (A) Python is case sensitive. 1
Reasoning : (B) In Python print() is correct but Print() is not correct.
Ans: (a)
CBT SAMPLE QP (10 QUES)
Q.1 Tick the correct statement to print hello. 1
A. print(hello)
B. print(“hello”)
C. Print(“hello”)
D. Print(hello)
Ans: B.print(“hello”)
Q.2 Find the output of the following program 1
A=0
print(a)
A. A
B. a
C. 0
D. error
Ans: D. error
Q.3 WWhich of the following will give output as [5,14,6] 1
If lst=[1,5,9,14,2,6] ?
A. print(lst[0::2])
B. print(lst[1::2])
C. print(lst[1:5:2])
D. print(lst[0:6:2])
Ans: B. print(lst[1::2]).
Q.4 What will be the output of the following statement: 1
print(3-2**2**3+99/11)
A. 244
B. 244.0
C. -244.0
D. Error
pg. 4
Ans: C. -244.0
Q.5 Identify the output of the following Python statements. 1
x=2
while x < 9:
print(x, end='')
x=x+1
A.) 12345678
B. 123456789
C. 2345678
D. 23456789
Ans: C. 2345678
Q.6 Evaluate the following expression and identify the correct answer. 1
16 - (4 + 2) * 5 + 2**3 * 4
A. 54
B. 46
C. 18
D. 32
Ans: C. 18
Q.7 Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90). 1
What will be the output of print (tup1 [3:7:2]) ?
A. (40,50,60,70,80)
B. (40,50,60,70)
C. [40,60]
D. (40,60)
Ans: D. (40,60)
Q.8 What will be the output of the following code: 1
Cities=[‘Delhi’,’Mumbai’]
Cities[0],Cities[1]=Cities[1],Cities[0]
print(Cities)
Ans: ['Mumbai', 'Delhi']
Q.9 Identify the output of the following Python statements. 1
lst1 = [10, 15, 20, 25, 30]
lst1.insert( 3, 4)
lst1.insert( 2, 3)
print (lst1[-5])
A. 2
B. 3
C. 4
D. 20
Ans: B. 3
Q.10 What will be the output of the following code? 1
tup1 = (1,2,[1,2],3)
tup1[2][1]=3.14
print(tup1)
A. (1,2,[3.14,2],3)
B. (1,2,[1,3.14],3)
C. (1,2,[1,2],3.14)
pg. 5
D. Error Message
Ans: B. (1, 2, [1, 3.14], 3)

15 Questions MLL (Revision Tour Class XI)


Q1. Write a python function which takes list of numbers from the user and returns the list
of prime numbers only out of the argument list
E.g. : if [5,60,12,31,17,1,56,98,0,32] is passed to the list
should return [5,31,17]

Q2. Write a function countNow(PLACES) in Python, that takes the dictionary PLACES as an
argument and displays the names (in uppercase) of the places whose names are longer than
5 characters.
For example, Consider the following dictionary
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
The output should be:
LONDON
NEW YORK

Q3. Write a function EVEN_LIST(L), where L is the list of elements passed as argument to the
function. The function returns another list named ‘evenList’ that stores the indices of all
even numbers of L.
For example: If L contains [12,4,3,11,13,56] The evenList will have - [0,1,5]

Q4. Write a function lenFOURword(L), where L is the list of elements (list of words) passed
as argument to the function. The function returns another list named ‘fourCharList’ that
stores the all four lettered word of L.
For example: If L contains [“DINESH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”]
The indexList will have [“AMAN”, “KARN”]

Q5. Write a function countVowel() in Python, which should read each character of a text file
“myfile.txt” and then count and display the count of occurrence of vowels (including small
cases)

Q6. Manoj is a python programmer, he has to write a function CalcInterest(), he defined it


as:
def CalcInterest (Principal, Rate=1.2,Time):
But his code is not working, Can you help Manoj to identify the error in the above function
and provide a solution.

Q7. Write a function COUNTWORDS( ) in python to display the count of words starting with
“T” or “S” in a text taken from the user

Q8. Write a function COUNTS( ) in Python to read the text file “ABC.TXT” and count the
number of times the word “THE” occurs in the file. (Case insensitive the)

Q9. Write a function modilst(L) that accepts a list of numbers as argument and increases the
value of the elements by 10 if the elements are divisible by 5. Also write a proper call
statement for the function.
pg. 6
For example: If list L contains [3,5,10,12,15]
Then the modilist() should make the list L as [3,15,20,12,25]

Q10.
Predict the output of the following code:
def Changer(P,Q=10) :
P=P/Q
Q=P%Q
return P
A=200
B=20
A=Changer(A,B)
print(A,B, sep='$')
B=Changer(B)
print(A,B, sep='$', end='###')

Q11. Write a function SQUARE_LIST(L), where L is the list of elements passed as argument to
the function. The function returns another list named ‘SList’ that stores the Squares of all
Non-Zero Elements of L.
For example:
If L contains [9,4,0,11,0,6,0]
The SList will have - [81,16,121,6]

Q12. Write a function called remove_underscores(s) that accepts a string as an argument.


Input : ____________Hello____world_____
Output: Helloworld

Q13. The code given below accepts a number as an argument and returns the reverse
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.

define revNumber(num):
rev = 0
rem = 0
While num > 0:
rem ==nurn %10
rev = rev* 10 4- rem
num = num//10
return rev
print(revNumber(1234))
15 Questions Assertion and Reasoning

ASSERTION (A) and REASONING (R) based questions. Chose the correct choice as your
answer
(a) Both (A) and (R) are true and (R) is the correct explanation for (A).
(b) Both (A) and (R) are true and (R) is not the correct explanation for (A).
(c) (A) is true but (R) is false.
(d) (A) is false but (R) is true.

1.

pg. 7
Assertion (A):- The default value of an argument will be used inside a function if we do not
pass a value to that argument at the time of the function call.
Reasoning (R):- the default arguments are optional during the function call. It overrides the
default value if we provide a value to the default arguments during function calls.
2.
Assertion (A):- To use a function from a particular module, we need to import the module.
Reasoning (R):- Import statement can be written anywhere in the program, before using a
function from that module.
3.
Assertion (A):- If the arguments in a function call statement match the number and order of
arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains default argument(s)
followed by positional argument(s).
4.
Assertion (A):- Local Variables are accessible only within a function or block in which it is
declared.
Reasoning (R):- Global variables are accessible in the whole program
5.
Assertion (A):- The default arguments can be skipped in the function call.
Reasoning (R):- The function argument will take the default values even if the values are
supplied in the function call
6.
Assertion (A):- Built in function are predefined in the language that are used directly.
Reasoning (R):- print () and input () are built in functions
7.
Assertion (A):- Key word arguments are related to the function calls.
Reasoning (R):- When you use keyword arguments in a function call, the caller identifies the
arguments by the parameter name.
8.
Assertion (A):- A function is a block of organized and reusable code that is used to perform a
single, related action.
Reasoning (R):- Function provide better modular form to application and a high degree of
code reusability
9.
Assertion (A):- Assertion. A function is a subprogram.
Reasoning (R):- A function exists within a program and works within it when called.
Assertion (A):- During a function call, the argument list first contains default argument(s)
followed by positional argument(s).
Reasoning (R):- Inside a function, we can declare local as well as global arguments.
10.
Assertion (A):- Non-default arguments cannot follow default arguments in a function call.
Reasoning (R):- A function call can have different types of arguments.
11.
Assertion (A):- A function declaring a variable having the same name as a global variable,
cannot use that global variable.
Reasoning (R):- A local variable having the same name as a global variable hides the global
variable in its function.
12.
Assertion (A):- A variable declared inside a function cannot be used outside it.

pg. 8
Reasoning (R):- A variable created inside a function has a function scope.
13.
Assertion (A):- A variable not declared inside a function can still be used inside the function
if it is declared at a higher scope level.
Reasoning (R):- Python resolves a name using LEGB rule where it checks in Local (L),
Enclosing (E), Global (G) and Built-in scopes (B), in the given order.

Revision of Class XI Questions MCQ

(1) Which keyword is use for function?


a) Fun
b) define
c) def
d) function

Answer: c

(2.)

a) Hello World!
Hello World!
b) ‘Hello World!’
‘ Hello World!’
c) Hello
Hello
d) None of the mentioned
Answer: a
(3.) What is the output of the below program?

pg. 9
a)
x is 50
Changed global x to 35
Value of x is 50
b) x is 50
Changed global x to 2
Value of x is 2
c)
x is 50
Changed global x to 50
Value of x is 50

(d) None of the mentioned

Answer: b

(4.) Which are the advantages of functions in python?


a) Reducing duplication of code
b) Decomposing complex problems into simpler pieces
c) Improving clarity of the code
d) All of the mentioned

Answer: d

(5.)Identify the output of the following python statements –

a)GOOD MORNING!Good morning


b)Good Morning!Good morning
c)Good morning !Good Morning!
d)Good morning Good Morning!

Answer : d

(6.)Predict the output of the following code.

Answer : 200 # 100

(7.)Find and write the output of the following python code .

pg. 10
Answer : gMAILabcCOM
(8.)What may be the output of the program given below –

a)0 : 0
b)2 : 4
c)1 : 2
d)0 : 5

Answer : a

(9.)Which of the following components are parts of a function header in Python?


(i) Function Name
(ii) Return Statement
(iii) Parameter List
(iv) def keyword

a)Only (i)
b)(i) and (ii)
c)(iii) and (iv)
d)(i), (iii) and (iv)

Answer : d

(10.)Predict the output of the following code.

a) 50 b) 0 c) Null d) None

Answer : d

pg. 11
(11.)What will be the output of the following code :

a)100 200
b)150 300
c)250 75
d)250 300

Answer : d

(12.)What will be the output of the following code :

a)50#50
b)5#5
c)50#30
d)5#50#

Answer : b

(13.)What will be the output of the following code :

a)5#8#15#4#
b)5#8#5#4#

pg. 12
c)5#8#15#14#
d)5#18#15#4#

Answer : b
(14.)What will be the output of the following code :

a)3 3 3
b)3 4 5
c)5 5 5
d)3 5 5

Answer : c

(15.)Identify the incorrect form of import statement.

a)from <module> import <object1> [<object2>, […]]


bfrom <module> import <object>
c)from <module> import all
d)All of the above

Answer : c

(16.)What is the scope of a variable declared in top level segment (– main –) of a program ?

a)Global
b)Local
c)Depends on its used
d)None of these.

Answer : a

(17.)Consider the following code.


def sum ( a, b): statement 1
s=a+b statement 2
return s statement 3
n1 = int (input (“Enter a number”)) statement 4
n2 = int (input (“Enter a number’)) statement 5
sum = sum (n1, n2) statement 6
print (“sum=”, sum) statement 7

Choose the correct order of the execution of statements


a)1→2→3→4→5→6→7
b)1→2→3→4→5→7→6
pg. 13
c)6→7→1→2→3→4→5
d)4→5→6→1→2→3→7

Answer : d

(18.)
...................... are the variables that are listed within parentheses of a function header.
a)Parameters
b)Arguments
c)Values
d)None of these

Answer : a

(19.)Scope of a variables declared in a function body is


a)Global
b)Local
c)Depends on function call
d)None of these

Answer :b
(20.)When the function call statement must match the number and order of arguments as
defined in the function definition, this is called the ....................... .
a)Default parameters
b)Positional argument
c)Formal parameters
d)Actual parameters
Answer : b
FUNCTION
Working with Functions MLL

Q.1)Define a function?

Ans: - It is a sub program that perform some task on the data and return a value.

Q.2)Write a python function that takes two numbers

and find their product. Ans: - def PRODUCT(X,Y):

return (X*Y)

Q.3)Write a python function that takes two numbers and print the smaller
number. Also write how to call this function.

Ans: - def SMALER(A,B):

if(A<B):

print(“Smaller No – “, A)

else:
pg. 14
print(“Smaller No – “, B)

a=int(input(“Enter a number:”))

b=int(input(“Enter

another umber:”))

SMALLER(a,b)

Q.4)How many values a python function can

return? Explain how?

Ans: Python function can return more than

one values.

def square_and_cube(X):

return X*X, X*X*X, X*X*X*X

a=3

x,y,z=sq

uare_an

d_cube()

print(x,y

Ans: - Part of program within which a name is legal and accessible is called scope of the
variable.

Q.5)Explain two types of variable scope with example.

Ans – Global Scope – A name declared in top level segment of a program is said to
have global scope and it is accessible inside whole programme.

Local Scope – A name declared in a function body is said to have local scope and it
can be used only within this function.

Q.6)Consider the following function headers. Identify the correct statement: -

1) def correct(a=1,b=2,c): 2) def correct(a=1,b,c=3):

c) def correct(a=1,b=2,c=3): 4) def correct(a=1,b,c):

Ans: - c) def correct(a=1,b=2,c=3)


pg. 15
Q7.Write a Python function reverse_string(s) that reverses a given string s. Provide the
function definition and an example of its usage.
def reverse_string(s):
""" Function to reverse a given string. """
return s[::-1]
# Example usage
string = "hello"
print("Reversed string:", reverse_string(string))

Q8. Define a Python function count_vowels(s) that counts and returns the number of vowels
in a given string s. Consider both uppercase and lowercase vowels. Provide the function
definition and an example of its usage.
def count_vowels(s):
""" Function to count the number of vowels in a given string. """
vowels = "aeiouAEIOU"
count = 0
for char in s:
if char in vowels:
count += 1
return count
# Example usage
string = "Python Programming"
print("Number of vowels in the string:", count_vowels(string))

Q9. Write a Python function calculate_fibonacci(n) that calculates and returns the nth
Fibonacci number using iteration (loop). Provide the function definition and an example of
its usage.
def calculate_fibonacci(n):
""" Function to calculate the nth Fibonacci number using iteration (loop). """
if n <= 1:
return n
else:
a, b = 0, 1
pg. 16
for _ in range(2, n + 1):
a, b = b, a + b
return b
Q10. Write a Python function calculate_factorial(n) that calculates the factorial of a non-
negative integer n using recursion. Provide the function definition and an example of its
usage.

def calculate_factorial(n):
"""Function to calculate the factorial of a non-negative integer using recursion. """
if n == 0 or n == 1:
return 1
else:
return n * calculate_factorial(n - 1)
# Example usage
number = 5
print("Factorial of", number, "is:", calculate_factorial(number))

Q11.Define a Python function check_prime(num) that checks if a given integer num is a


prime number. Provide the function definition and an example of its usage.
def check_prime(num):
""’’ Function to check if a given integer is a prime number """
if num <= 1:
return False
elif num == 2:
return True
elif num % 2 == 0:
return False
else:
for i in range(3, int(num**0.5) + 1, 2):
if num % i == 0:
return False
return True

pg. 17
# Example usage
number = 23
if check_prime(number):
print(number, "is a prime number.")
else:
print(number, "is not a prime number.")

MCQ FUNCTION

1. Lalit is a game programmer and he is designing a game where he has to use different
python functions as much as possible. Apart from other things, following functionalities are
to be implemented in the game.

(1) He is simulating a dice where random number generation is required.


(2) Since the program becomes too lengthy, Lalit wants a separate section where he can
store all the functions used in the game program.

Lalit is feeling difficulty in implementing the above functionalities. Help him by giving
answers following questions:

(1) which module can be used:


a) random
b) randomise
c) randint
d) math

Ans: b) randomise

(2) Lalit should use


a) in-built functions
b) He should write another Python program
c) He should use a module with all the required functions
d) He should make a separate section in the same Python program

Ans: (c)

2. One student who is learning Python, is making a function-based program to find the roots
of a quadratic equation. He wrote the program but he is getting some error. Help him to
complete the task successfully:

from ……… import sqrt LINE-1


Def quad(b,c,a=1): LINE-2
x = b*b-4*a*c 4 LINE-3
if x < 0: LINE-4
pg. 18
return “Sorry,complex root(s)” LINE-5
d = sqrt(x) LINE-6
r1 = (-b + d)/(2*a) LINE-7
r2 = (-b – d)/(2*a) LINE-8
return r1,r2 LINE-9
print(quad(1,1,2)) LINE-10
root = quad(3) LINE-11
rt = quad(2,1) LINE-12

i) Which python module should be used in line 1


a) random
b) CMath
c) math
d) Either (b) or (c)

ii) Which statement is correct with reference to above program?

a) Two return statements are used and a function can use only one return statement
b) Required module is not given
c) Syntax error in line 4
d) Error in line 11

3. Carefully observe the code and give the answer.

def function1(a):
a = a + '1'
a=a*2

i) What will be the output of the above function:


a) indentation Error
b) cannot perform mathematical operation on strings
c) hello2
d) hello2hello2

Answer
a) indentation error
Reason — The line a = a * 2 should be indented backwards otherwise it will give an error.

ii) Write the statement that will call the above function:
a) function1()
b) function1(25,30)
c) function1(a=10)
d) function1(30,)

Answer
c) function1(a=10)
Reason — The function can call with single argument otherwise it will give an error.

pg. 19
4. Observe the following code and the answer of following questions:
def print_double(x=5):
print(2 ** x)
print_double() Statement 1
print_double(3) Statement 2

i) What will be the output of statement:


a) 32
b) 16
c) 8
d) 4

Answer
a) 32
Reason — The code defines a function named print_double that takes one parameter x. Inside
the function, it calculates 2 raised to the power of x using the exponentiation operator **,
and then prints the result. So, when we call print_double(), we're not passing any argument
to the function then it will take default argument that is 5. The function calculates 2 ** 5,
which is 32, and prints the result.

ii) Which of the given argument types can be skipped from a function call?
a) positional arguments
b) keyword arguments
c) named arguments
d) default arguments

Answer
d) default arguments
Reason — A default argument is an argument with a default value in the function header,
making it optional in the function call. The function call may or may not have a value for it.

5. Observe the following code and give the suitable the answer for following questions:
def person(name, age, city):
print(name, "is", age, "years old and lives in", city)

person(age=25, name="Alice", city="New York") Statement 1


person(city="London", name="Bob", age=30) Statement 2

i) What will be the output of the Statement 2:


a) Bob is 30 years old and lives in London
b) London is Bob years old and lives in 30
c) Alice is 25 years old and lives in New York
d) None of these

Answer:
a) Bob is 30 years old and lives in London
pg. 20
Reason — Keyword arguments allow us to specify arguments by their parameter names
during a function call, irrespective of their position.

ii) In the above code which type of argument used during function call:
a) Default Argument
b) Keyword Argument
c) Positional Argument
d) None of these

Answer:
b) Keyword Argument
Reason — Keyword arguments allow us to specify arguments by their parameter names
during a function call, irrespective of their position.

6. Ravish write down the following code in Python. But he is confused in Built in function
and User Defined function help him to find out built-in functions and user defined functions.

name = input("Enter your name: ")


name_length = len(name)
print("Length of your name:", name_length)

def calculate_area(length, width):


area = length * width
return area
length = 5
width = 3
result = calculate_area(length, width)
print("Area of the rectangle:", result)

Answer:

Built-in functions — These are pre-defined functions and are always available for use. For
example:
In the above example, print(), len(), input() etc. are built-in functions.

User defined functions — These are defined by programmer. For example:


In the above example, calculate_area is a user defined function.

7. Raman written the following code. Observe the following code and answer the following
question:
total = 0
def sum(arg1, arg2):
total = arg1 + arg2
print("Total :", total)
return total
sum(10, 20)
print("Total :", total)
pg. 21
i) Write the function with default argument for argument 2 and set the value is 10.
Answer:
total = 0
def sum(arg1, arg2=10):
total = arg1 + arg2
print("Total :", total)
return total
sum(10, 20)
print("Total :", total)

ii) What is the benefit of default argument?


Answer:
Default arguments — Default arguments are used to provide a default value to a function
parameter if no argument is provided during the function call.

8. Observe the following code and answer the following questions:


def Tot(Number) #Method to find Total
Sum = 0
for C in Range (1, Number + 1):
Sum += C
RETURN Sum
print (Tot[3]) #Function Calls
print (Tot[6])

i) Correct the above code.


Answer:
def Tot(Number): #Method to find Total
Sum = 0
for C in range(1, Number + 1):
Sum += C
return Sum
print(Tot(3)) #Function Calls
print(Tot(6))

Reason —
There should be a colon (:) at the end of the function definition line to indicate the start of
the function block.
Python's built-in function for generating sequences is range(), not Range().
Python keywords like return should be in lowercase.
When calling a function in python, the arguments passed to the function should be enclosed
inside parentheses () not square brackets [].

ii) Predict the output:

Answer:
6
pg. 22
21

9. Consider the following code line numbers have been given for your reference.

1. def power(b, p):


2. y = b ** p
3. return y
4.
5. def calcSquare(x):
6. a = power(x, 2)
7. return a
8.
9. n = 5
10. result = calcSquare(n)
11. print(result)

i) Write the flow of execution for above code.

Answer:
The flow of execution for the above program is as follows:
1 → 5 → 9 → 10 → 5 → 6 → 1 → 2 → 3 → 6 → 7 → 10 → 11

Explanation
Line 1 is executed and determined that it is a function header, so entire function-body (i.e.,
lines 2 and 3) is ignored. Line 5 is executed and determined that it is a function header, so
entire function-body (i.e., lines 6 and 7) is ignored. Lines 9 and 10 are executed, line 10 has a
function call, so control jumps to function header (line 5) and then to first line of function-
body, i.e., line 6, it has a function call, so control jumps to function header (line 1) and then
to first line of function-body, i.e, line 2. Function returns after line 3 to line 6 and then returns
after line 7 to line containing function call statement i.e, line 10 and then to line 11.
ii) What will be the output if it takes n=8.

Answer:
64
10. Consider the code below and answer the questions that follow :

def multiply(number1, number2):


answer = number1 * number2
print(number1, 'times', number2, '=', answer)
return(answer)
output = multiply(5, 5)
(i) When the code above is executed, what prints out ?

Answer
5 times 5 = 25

(ii) What is variable output equal to after the code is executed?

Answer
pg. 23
After the code is executed, the variable output is equal to 25. This is because the function
multiply returns the result of multiplying 5 and 5, which is then assigned to the variable
output.

Exception Handling MCQ


1. How many except statements can a try-except block have?
a) zero
b) one
c) more than one
d) more than zero

Answer: d
Explanation: There has to be at least one except statement.

2. When will the else part of try-except-else be executed?


a) always
b) when an exception occurs
c) when no exception occurs
d) when an exception occurs in to except block

Answer: c
Explanation: The else part is executed when no exception occurs.

3. Can one block of except statements handle multiple exception?


a) yes, like except TypeError, SyntaxError [,…]
b) yes, like except [TypeError, SyntaxError]
c) no
d) none of the mentioned

Answer: a
Explanation: Each type of exception can be specified directly. There is no need to put it in a
list.

4. When is the finally block executed?


a) when there is no exception
b) when there is an exception
c) only if some condition that has been specified is satisfied
d) always

Answer: d
Explanation: The finally block is always executed.

5. What will be the output of the following Python code?


def foo():
try:
return 1

pg. 24
finally:
return 2
k = foo()
print(k)
a) 1
b) 2
c) 3
d) error, there is more than one return statement in a single try-finally block

Answer: b
Explanation: The finally block is executed even there is a return statement in the try block.

6. What will be the output of the following Python code?


def foo():
try:
print(1)
finally:
print(2)
foo()
a) 1 2
b) 1
c) 2
d) none of the mentioned

Answer: a
Explanation: No error occurs in the try block so 1 is printed. Then the finally block is
executed and 2 is printed.

7. Which of the following is not an exception handling keyword in Python?


a) try
b) except
c) accept
d) finally

Answer: c
Explanation: The keywords ‘try’, ‘except’ and ‘finally’ are exception handling keywords in
python whereas the word ‘accept’ is not a keyword at all.

8. What will be the output of the following Python code if the input entered is 6?
valid = False
while not valid:
try:
n=int(input("Enter a number"))
while n%2==0:
print("Bye")
valid = True
except ValueError:
pg. 25
print("Invalid")
a) Bye (printed once)
b) No output
c) Invalid (printed once)
d) Bye (printed infinite number of times)

Answer: d
Explanation: The code shown above results in the word “Bye” being printed infinite number
of times. This is because an even number has been given as input. If an odd number had
been given as input, then there would have been no output.

9. Which of the following statements is true?


a) The standard exceptions are automatically imported into Python programs
b) All raised standard exceptions must be handled in Python
c) When there is a deviation from the rules of a programming language, a semantic error is
thrown
d) If any exception is thrown in try block, else block is executed

Answer: a
Explanation: When any exception is thrown in try block, except block is executed. If
exception in not thrown in try block, else block is executed. When there is a deviation from
the rules of a programming language, a syntax error is thrown. The only true statement
above is: The standard exceptions are automatically imported into Python programs.

10. An exception is ____________


a) an object
b) a special function
c) a standard module
d) a module

Answer: a
Explanation: An exception is an object that is raised by a function signaling that an unexpected
situation has occurred, that the function itself cannot handle.

EXCEPTION HANDLING
5 Questions MCQ (Exception Handling)
Q.1 Which keyword is used to force an exception ? 1
a. try, (b) except, (c) raise, (d) finally
Ans: a. try
Q.2 Error raised when an I/O operation fails for an I/O operations. 1
a. Name Error, (b) EOF Error, (c) IO Error, (d) Value Error
Ans: (c) IO Error
Q.3 Which of the following keywords are not specific to exception handling? 1
a. try, (b) except, (c)finally, (d) else
Ans: (d) else
Q.4 Which one is not example of exception: 1

pg. 26
a. Divide by zero, (b) Invalid Input, (c) Opening a non existing file,
(d) print string “hello” using print(“hello”)
Ans: (d) print string “hello” using print(“hello”)
Q.5 An unexpected error that occurs during runtime. 1
a. Exception, (b) try, (c) catch, (d) stack trace
Ans: a. Exception

10 Question Assertion and Reasoning (Exception Handling)

In the following question, a statement of assertion (A) is followed by a statement of reason


(R).Mark the correct choice as :
a)Both A and R are correct, and R is the correct explanation of A.
b)Both A and R are correct, but R is not the correct explanation of A
c) A is correct, but R is not correct.
d)A is not correct, but R is correct.
1.Assertion (A): Exception handling in Python allows for graceful recovery from errors and
prevents program crashes.
Reason (R): When an error occurs during program execution, Python's exception handling
mechanism allows the program to gracefully handle the error and take corrective action.
2.Assertion. Exception handling is responsible for handling anomalous situations during
the execution of a program
Reason. Exception handling handles all types of errors and exceptions.
3.Assertion. Exception handling code is separate from normal code.
Reason. Program logic is different while exception handling code uses specific keywords to
handle exceptions.
4.Assertion. Exception handling code is clear and block based in Python.
Reason. The code where unexpected runtime exception may occur is separate from the
code where the action takes place when an exception occurs.
5.Assertion. No matter what exception occurs, you can always make sure that some
common action takes place for all types of exceptions.
Reason. The finally block contains the code that must execute.
6.Assertion:- Try block will execute the code of the program
Reason:- except block handle the errors
7.Assertion:- Try block contain the code of the program which may contain exceptions
Reason:- Finally block contain the code which are finally not to be executed
8.Assertion:- Except block not handle any exception
Reason:- Try block not contain the code of the program which may contain exceptions
9.Assertion:- Exceptions are some runtime errors
Reason:- There are built-in python exceptions .
10.Assertion:- There are only one Try block
Reason:- There are multiple except block to handle multiple type of exceptions

Assertions/Reasons Ans:-
1. (a) 2(c) 3. (a) 4. (a) 5. (a) 6 (a) 7. (c) 8 (d) 9. (b) 10. (b)

EXCEPTION HANDLING + FILEHANDLING– MCQ QUESTIONS

pg. 27
Q1 You are building a calculator program that takes user input for two numbers and performs
arithmetic operations. Implement exception handling to handle cases where the user enters
invalid input.
Question:
How would you handle the scenario where the user enters a non-numeric value instead of a
number?
a) Use a try-except block to catch a `ValueError` and display an error message to the user.
b) Use a try-except block to catch a `TypeError` and display an error message to the user.
c) Use a try-except block to catch an `IndexError` and display an error message to the user.
d) Use a try-except block to catch a `SyntaxError` and display an error message to the user.

Q2 You are writing a program that reads data from a file and performs some calculations.
Implement exception handling to handle cases where the file does not exist.
Question:
How would you handle the scenario where the file specified by the user does not exist?
a) Use a try-except block to catch a `FileNotFoundError` and display an error message.
b) Use a try-except block to catch a `ValueError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch an `IndexError` and display an error message.

Q3 You are working on a program that receives network data. Implement exception handling
to handle cases where the network connection is lost.
Question:
How would you handle the scenario where the network connection is lost while receiving
data?
a) Use a try-except block to catch a `ConnectionError` and attempt to reconnect.
b) Use a try-except block to catch a `ValueError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch an `IndexError` and display an error message.
Q4
You are building a web scraping program that extracts data from a website. Implement
exception handling to handle cases where the website is down or unreachable.
Question:
How would you handle the scenario where the website is down or unreachable?
a) Use a try-except block to catch a `ConnectionError` and display an error message.
b) Use a try-except block to catch a `FileNotFoundError` and display an error message.
c) Use a try-except block to catch a `TypeError` and display an error message.
d) Use a try-except block to catch a `ValueError` and display an error message.

Q5 You are writing a program that performs database operations. Implement exception
handling to handle cases where the database connection fails.
Question:
How would you handle the scenario where the database connection fails?
a) Use a try-except block to catch a `DatabaseError` and display an error message.
b) Use a try-except block to catch a `NameError` and display an error message.
c) Use a try-except block to catch a `SyntaxError` and display an error message.
d) Use a try-except block to catch a `ValueError` and display an error message.

Q6 Consider the following scenario:

pg. 28
You need to read the contents of a text file into a list in Python, excluding any empty lines.
Which approach should you take?
A) Read the file using `file.read()` and then remove empty lines using a loop.
B) Use the `file.readlines()` method to read the file into a list and remove empty lines using a
loop.
C) Use the `file.read().splitlines()` method to read the file into a list, which automatically
excludes empty lines.
D) Read the file using `file.read()` and then use the `filter()` function to remove empty lines
from the resulting list.
Q7 Consider the following scenario:
You are working on a project that involves reading a text file with a large number of lines. You
want to process the file line by line efficiently, without loading the entire file into memory.
Which approach should you use?
A) Use the `file.read()` method to read the entire file and then iterate over the lines.
B) Use the `file.readlines()` method to read all the lines at once and then iterate over them.
C) Iterate over the file object directly without using any specific method for reading the lines.
D) Use the `file.readline()` method inside a loop to read and process each line sequentially.
Q8 Consider the following scenario:
You need to write a list of strings to a text file, where each string should be written as a
separate line. Which approach is recommended for achieving this?
A) Use the `file.write()` method to write each string, followed by a line break character.
B) Concatenate the strings into a single string with line break characters and then use the
`file.write()` method.
C) Use the `file.writelines()` method, passing the list of strings as an argument, without any
additional characters.
D) Iterate over the list of strings and use the `file.write()` method for each string, followed by
a line break character.

Q9 Which of the following code snippets correctly demonstrates the usage of a `with`
statement to automatically close a file after reading its content?
a) file = open("data.txt", "r")
content = file.read()
print(content)
file.close()
b) with open("data.txt", "r") as file:
content = file.read()
print(content)
c) with open("data.txt", "r") as file
content = file.read()
print(content)
d) file = open("data.txt", "r")
content = file.read()
print(content)
close(file)
Q10 Which of the following code snippets correctly opens a text file named "log.txt" in append
mode and appends the string "Error: File not found!" to it?
a) file = open("log.txt", "a")
file.write("Error: File not found!")
file.close()
b) file = open("log.txt", "w")

pg. 29
file.write("Error: File not found!")
file.close()
c) file = open("log.txt", "r")
file.write("Error: File not found!")
file.close()
d) file = open("log.txt", "append")
file.write("Error: File not found!")
file.close()

ANSWER
1. A 2.A 3.A 4.A 5.A 6.C 7.C 8.C 9.B 10.A
Exception Handling MCQ
1. Vikas type the following code. What will happen if he executes the following code.
try:
print(x)
except:
print("An exception has occurred!")

a) try block will execute


b) except block will execute
c) no output will come
d) program is incomplete

Answer b) An exception has occurred! Because x is not defined.

2. Manish write the following code of Python. What will be the output, if he executes the
following code?
try:
print(1/0)
except ZeroDivisionError:
print("You cannot divide a value with zero")
except:
print("Something else went wrong")

a) Something else went wrong


b) You cannot divide a value with zero
c) code will not execute
d) code is wrong

Answer b)
Explanation: The code will output “Divide by zero error” because a ZeroDivisionError
exception is raised

3. What does the following code snippet do?


try:
x = int("abc")
except ValueError:
print("Invalid literal for int()")
pg. 30
finally:
print("Finally block executed")

a) Attempts to convert a string to an integer and prints an error message if it fails


b) Prints “Finally block executed” regardless of the outcome
c) Raises a ValueError exception
d) Terminates the program

Answer: b
Explanation: The finally block is always executed, regardless of whether an exception is raised
or caught.

4. What will be the output of the following code?


try:
x = int(input("Enter a number: "))
except ValueError:
print("Invalid input")
else:
print("You entered:", x)
a) “Invalid input”
b) “You entered: <number>”
c) Nothing will be printed
d) Error: invalid literal for int() with base 10: ‘<input>’

Answer: b
Explanation: If the input is successfully converted to an integer, it will print “You entered:
<number>”. Otherwise, it will print “Invalid input”.

5. What will be the output of the following code?


try:
raise IndexError("Index out of range")
except ValueError:
print("ValueError")
except IndexError:
print("IndexError")
except Exception:
print("Exception")
a) “ValueError”
b) “IndexError”
c) “Exception”
d) “Index out of range”

Answer: b
Explanation: The code will output “IndexError” because an IndexError exception is raised and
caught.

6. What is the purpose of the raise statement in Python?


pg. 31
a) To handle exceptions
b) To terminate the program
c) To define a new exception
d) To print an error message

Answer: c
Explanation: The raise statement is used to explicitly raise exceptions in Python.

7. What will happen if an exception is raised but not caught in a Python program?
a) The program will continue executing normally
b) The program will terminate with an error message
c) The program will pause and wait for user input
d) The program will enter an infinite loop

Answer: b
Explanation: If an exception is raised but not caught, the program will terminate with an error
message

8. Which of the following keywords is used to catch all exceptions in Python?


a) try
b) catch
c) except
d) finally

Answer: c
Explanation: The except keyword is used to catch all exceptions in Python.

9. Which of the following is true about the else block in Python exception handling?
a) The else block is executed if an exception occurs
b) The else block is always executed after the except block
c) The else block is executed if no exceptions occur in the try block
d) The else block is optional in exception handling

Answer: c
Explanation: The else block is executed if no exceptions occur in the try block.

10. What does the following code snippet do?


try:
x = int(input("Enter a number: "))
y = int(input("Enter another number: "))
result = x / y
except ValueError:
print("Invalid input")
except ZeroDivisionError:
print("Cannot divide by zero")
else:
print("Result:", result)
pg. 32
finally:
print("End of program")
a) Asks the user to enter two numbers, divides them, and prints the result
b) Asks the user to enter two numbers and prints their sum
c) Prints “Invalid input” if the user enters a non-integer value
d) Prints “Cannot divide by zero” if the user enters zero as the second number

Answer: a
Explanation: The code asks the user to enter two numbers, divides them, and prints the result.
It also handles exceptions for invalid input and zero division.

11. Python Files can be of following types


a. Text
b. Binary
c. csv
d. All the above

12. In python the basic I/O Streams is/are________*


a. Standard Input
b. Standard Output
c. Standard Errors
d. All of the above

13. Pickling in python means ?*


a. Python object is converted into a byte stream,
b. Python byte stream is converted into python object
c. both statements are true
d. None of the above are true

14. if file contains "Guido van Rossum is a Dutch programmer best known as the
creator of the Python programming language" then what will be the output of this
program?*

a. 100
b. 101
c. 102
d. 3

15. Unpickling in python means ?*


a. Python object is converted into a byte stream,
b. Python byte stream is converted into python object
c. both statements are true
pg. 33
d. None of the above are true

16.To rename a file 'Myfile.txt' to 'New_File.txt' correct syntax is*


a. New_FIle.txt = MyFile.txt
b. os.rename(New_File.txt, MyFIle.txt)
c. os.rename('New_File.txt', 'MyFIle.txt')
d. os.change('New_File.txt', 'MyFIle.txt')

17. What is/are true in respect of python tell() method?


a. tells the current position within the file.
b. will tell the file mode we are using
c. Move the file pointer at desired location
d. All are correct

18. d=f.readline() statement will return ...................*


a. tuple of list
b. list of strings
c. string of list
d. A string

19. Nayana want to write 567 records in the file. If she want to store data in file ,( in
parts) on different working days then which mode must be used.*
a. w
b. r
c. a
d. wr

20. What is/are not true in respect of following code*

a. It will open binary file in write mode and write list in file after converting byte_arr into
binary
b. It will open binary file in write as well as read mode and write list in file after
converting byte_arr into binary
c. After writing byte_array (list) in binary format, file pointer is sent at beginning to read
the file content
d. At the time of reading content we are converting binary data into list data type

pg. 34
21.What is/are not true about the following code*

a. Pickling is the process of converting a Python object into a byte stream to store it in
a file/database
b. pickle.dump() method is used to read data from file
c. pickle.dump() method is used to write data into the binary file
d. We can only Write (can not read from file) into the file using pickle module

22. Correct syntax of dump() method of pickle module is*


a. file_object=pickle.dump(object_to_write)
b. pickle.dump(object_to_write,file_object)
c. object_to_write=pickle.dump(file_object)
d. Any one can be used

23.What is not true about absolute and relative path in python*


a. A absolute path defines a location that is relative to the current directory or folder
where as : An absolute path refers to the complete details needed to locate a file or
folder
b. At the time of Program run Python searches current(default) directory.
c. Path is the name of a file or directory, specifies a unique location in a file system
d. A relative path defines a location that is relative to the current directory or folder
where as : An absolute path refers to the complete details needed to locate a file or
folder

24. CSV stands for*


a. Common Storage Version
b. Comma Storage Version
c. Comma Separated Values
d. Comma Separated Versions

25. To Create CSV files we need module*


a. pickle
b. file handling
c. csv
d. CSV

DATA STRUCTURE
DATA STRUCTURE ASSERTION AND REASONING
Directions Mark the correct choice as
(a)Both A and R are true and R is the correct explanation for A.
(b)Both A and R are true and R is not the correct explanation for A
pg. 35
(c)A is true but R is False.
(d)A is False but R is true
1 Assertion(A)-A Stack is a LIFO structure.
Reasoning (R)-Any new element pushed into the stack always gets positioned at the
index after the last existing element in the stack.
Ans: - (a)
2 Assertion(A)-A Stack is a linear list implemented in Last in First Out manner.
Reasoning (R)-Insertion and deletions are restricted to occur only at one end-Stack’s
top
Ans: - (a)
3 Assertion(A): -Insertion in the Stack is known as PUSH operation.
Reasoning(R): -When one tries to push an item in stack that is full, Overflow occurs.
Ans: - (b)
4 Assertion(A): -POP operation removes item from Top of the Stack.
Reasoning(R): -Underflow refers to situation when one tries to delete an item from an
empty stack.
Ans: - (b)
5 Assertion(A): -LIFO stands for Last in First Out.
Reasoning(R): -An element may be inserted at both ends of the Stack.
Ans: - (c)
6 Assertion(A): - A Stack is a linear structure where insertions and deletions take place
only at one end i.e. the stack’s top
Reasoning(R): - A Stack is a FIFO Structure.
Ans: - (c)
7 Assertion(A): -A Stack allows insertion and deletion of element at both the ends
Reasoning(R): Stack is a LIFO Data Structure.
Ans: - (d)
8 Assertion(A):- When someone attempt to delete an item from empty stack Overflow
occurs,
Reasoning(R): An item is allowed to be deleted only from the Top of the Stack
Ans: - (d)
9 Assertion(A): -In Python, a Stack is implemented through Lists.
Reasoning(R): Append () method of list is used for PUSH operation
Ans: -(b)
10 Assertion(A): -Program should check for Overflow condition before executing PUSH
operation on Stack and similarly check for Underflow before executing POP operation.
Reasoning(R): In Stack Underflow, means there is no element available in the stack,
while overflow means no further element can be pushed into Stack.
Ans: -(a)

ASSERTION & REASONING DATA STRUCTURE (10 QUESTIONS)

ASSERTION AND REASONING based questions. Mark the correct choice as


(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is False but R is True
1. Assertion (A): Using append(), many elements can be added at a time.
Reason(R): For adding more than one element, extend() method can be used.

pg. 36
2. Assertion (A): A data structure is a named group of data types.
Reason(R): A data structure has a well-defined operations, behavior and properties.
3. Assertion (A): LIFO is a technique to access data from queues.
Reason(R): LIFO stands for Last In First Out.
4. Assertion (A): A Stack is a Linear Data Structure that stores the elements in FIFO order.
Reason(R): New element is added at one end and element is removed from that end only.
5 Assertion (A): An error occurs when one tries to delete an element from an empty stack.
Reason(R): This situation is called an Inspection.
6. Assertion (A): A stack is a LIFO structure.
Reason(R): Any new element pushed into the stack always gets positioned at the index after
the
last existing element in the stack.
7. Assertion (A): In stack, program should check for Underflow condition, before executing
the
pop operation.
Reason(R): In stack, underflow mean there is no element available in the stack or stack is an
empty stack.
8. Assertion (A): Program should check for overflow condition, before executing push
operation on stack and similarly check for underflow before executive pop operation.
Reason(R): In stack underflow, means there is no element available in the stack, while
overflow means no further element can be pushed into stack.
9. Assertion (A): Stake is a linear data structure that works on the principle of FIFO (First in
First Out).
Reason(R): The stake is created with the help of a list with some restrictions. it manages a
pointer called Stack Pointer (SP) that will increase or decrease by 1, if an element is entered
or removed from the stack respectively.
10. Assertion (A): The element in Stack is removed from the top.
Reason(R): The process of removal is called POP
MCQ (Data Structure)

1. Data structure stack is also known as --------- list.


a) First in last out b) First in first out
c) last in first out d) All of these
2. Data structure Queue is also known as ---------------- list.
a. First in first out b) First in Last out
c) Last in First out d) All of these
3. In a stack, all insertion takes place at ---------------- end(s).
a. Top b) front c) rear d) any
4. In a Queue, insertion takes place at -------- end.
a. Front b) top c) ) rear d) any
5. In a stack, deletions takes place at ------------ end.
a. Front b) top c) rear d) any
6. The terms PUSH and POP are related to
a. Queue b) stack c) Both d) None
7. Stack follows the strategy of -----------
a. LIFO b) FIFO c) LRU d) RANDOM
8. Which of the following is an application of stack?
a. Finding factorial b) Reversing of a string
c) Infix to postfix d) All of the above

pg. 37
9. Pushing an element into stack already having five elements and stack ha fixed size of
5., then ---------- occurs.
a. Overflow b) Crash c) Underflow d) User flow
10. When a stack is empty and an element’s deletion is tried from the stack, it is called
an ---------------.
a. Overflow b) Underflow c) Extraflow d) Noflow

Ans:-
1. a and c 2) a 3) a 4) c 5) b 6) b 7) a 8) d 9) a 10) b

DATA STRUCTURE (10 Ques.MLL)

Q.1 A list contains following record of a customer:


[Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the stack named
‘status’:
(i) Push_element() - To Push an object containing name and Phone number of customers who
live in Goa to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display “Stack
Empty” when there are no elements in the stack.
For example:
If the lists of customer details are:
[“Gurdas”, “99999999999”,”Goa”]
[“Julee”, “8888888888”,”Mumbai”] [“Murugan”,”77777777777”,”Cochin”]
[“Ashmit”, “1010101010”,”Goa”]
The stack should contain
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
The output should be:
[“Ashmit”,”1010101010”]
[“Gurdas”,”9999999999”]
Stack Empty

(2.)Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details
of stationary items– {Sname:price}.
The function should push the names of those items in the stack who have price greater than
75. Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
Pen
The output should be:
The count of elements in the stack is 2

(3.)Stack is a data structure that follows _________ order


a. FIFO
b. LIFO
c. LILO

pg. 38
d. FILO

(4.)Queue is a data structure that follows ___________ order


a. FIFO
b. LIFO
c. LILO
d. FILO

(5.)Write down the status of Stack after each operation:


Stack =[10,20,30,40] where TOP item is 40
(i) Push 70
(ii) Push 100
(iii) Pop an item from Stack
(iv) Peek the Stack

(6.)Given the list:


MYLIST = [5,11,17,19,25,29,30,30,32,46,90]
Write down the Python statements for the following requirement:
(i) To find the number of items in MYLIST
(ii) To find the frequency of item 30 in MYLIST i.e. how many times 30 is in MYLIST
(iii) Write the code to insert 45 in the above sorted list to its correct position (do not disturb
the sorting)
(iv) Write the code to delete 17 from the above sorted list

(7.)Write the function CountEvenOdd(MYLIST) to find the count of all Even


elements and sum of all Odd elements.
For e.g if the elements are –

8 12 17 19 25 28 33 32 56 90

Output should be:


Even Count = 6
Odd Sum = 4

(8.)Write a function Sum7End(MYLIST), which display only those items from the list which
ends from the digit 7, also find total of these elements.
For e.g. if MYLIST = [10,27,15,107,97,5,7,81,47]
The output should be
27
107
97
7
47
Total = 285

(9.)Write a function in python, Push(Employee) and Pop(Employee) to add a new


Employee and delete a Employee from a List of Employee Names, considering them to act as
push and pop operations of the Stack data structure.

pg. 39
(10.)A dictionary contains the names of some cities and their population in crore. Write a
python function push(stack, data), that accepts an empty list, which is the stack and data,
which is the dictionary and pushes the names of those countries onto the stack whose
population is greater than 25 crores.
For example :
The data is having the contents {'India':140, 'USA':50, 'Russia':25, 'Japan':10} then the
execution of the function push() should push India and USA on the stack.
Solutions MLL
(1.)
status=[]
def Push_element(cust):
if cust[2]=="Goa":
L1=[cust[0],cust[1]]
status.append(L1)

def Pop_element ():


num=len(status)
while len(status)!=0:
dele=status.pop()
print(dele)
num=num-1
else:
print("Stack Empty")

(2.) stackItem=[]
def Push(SItem):
count=0
for k in SItem:
if (SItem[k]>=75):
stackItem.append(k)
count=count+1
print("The count of elements in the stack is : ", count)

(3.) b. LIFO

(4.) a. FIFO

(5.)
(i) [10,20,30,40,70]
(ii) [10,20,30,40,70,100]
(iii) [10,20,30,40,70]
(iv) 70
(6.)
(i) print(len(MYLIST))
(ii) print(MYLIST.count(30))
(iii) import bisect
bisect.insort(MYLIST,45)
print(MYLIST)
(iv) MYLIST.remove(17)

pg. 40
print(MYLIST)
(7.)
def CountEvenOdd(MYLIST):
counte=0
counto=0
for i in range(len(MYLIST)):
if MYLIST[i]%2==0:
counte+=1
else:
counto+=1
print("Even Count = ",counte)
print("Odd Count = ",counto)

(8.)
def Sum7End(MYLIST):
sum=0
for i in range(len(MYLIST)):
if MYLIST[i]%10==7:
print(MYLIST[i])
sum+=MYLIST[i]
print('Total=',sum)
(9.)
def Push(Employee):
name=input('Enter Employee name ')
Employee.append(name)
def Pop(Employee):
if len(Employee)==0: # or if Employee==[]:
print('Underflow')
else:
name = Employee.pop()
print('Popped Name was ',name)
(10.)
data={'India':140, 'USA':50, 'Russia':25, 'Japan':10}
stack=[]
def push(stack, data):
for x in data:
if data[x]>25:
stack.append(x)
push(stack, data)
print(stack)

COMPUTER NETWORKS
ASSERTION & REASONING

Topic: Transmission Media+ Network Devices

In the following questions, a statement of assertions (A) is followed by a statement of Reason (R).
Make the correct choice as
(a) Both A and R are true and R is the correct explanation of A
pg. 41
(b) Both A and R are true and but R is not the correct explanation of A
(c) A is true, but R is false, or partly true
(d) A is false or partly true, but B is true
(e) Both A and R are falls or not fully true

1. Assertion: The twisted pair cable is most commonly used wiring in LANs
Reason: Because of high attenuation, it is incapable of carrying signals over long distance without
repeater.
Answer: b

2. Assertion: The co-axial cable is suitable for high speed communication


Reason: The co-axial cable has high electrical properties and provides high speed for broadband
connections.
Answer: a

3. Assertion: Microwave provides better transmission than radio wave


Reason: Due to its higher frequency property, microwave can be used for longer distance
communication.
Answer: a

4. Assertion: Wired media is called unguided media


Reason: Microwave, radio wave and satellite are the example of Unguided media.
Answer: d

5. Assertion: A modem is a communication device that works on the principle of converting digital
data to analog and vice versa.
Reason: Modulation is a process of converting digital data to analog form and Demodulation is a
process of converting analog data to digital.
Answer: a

6. Assertion:A hub can also act as an amplifier.


Reason:An active hub is capable of amplifying the signal whereas a passive hub merely lets the signal
pass through it.
Answer: a

7. Assertion: A router and Bridge are similar


Reason: A router works like a bridge but can handle different protocols unlike bridge.
Answer: b

8. Assertion: A repeater is like an amplifier


Reason: A repeater regenerates signals and thereby removes noise.
Answer: a

9. Assertion: Hubs and Switches can be replaced


Reason: While a hub is a broadcast device , a switch is a unicast device.
Answer: b

10. Assertion: A switch is like an intelligent hub


Reason: Switch provides connectivity to more nodes along with dedicated bandwidth in a network.

pg. 42
Answer: a

11. Assertion: A hub is less effective and less intelligent than a Switch
Reason: A Router is least smart and least complicated device.
Answer: c

12. Assertion: A router can work like a bridge and can also handle different protocols.
Reason: A router can locate the destination required by sending the traffic to another router, if the
destination is unknown to itself.
Answer: a

13. Assertion: MAC address is physical address assigned to hardware like Network Interface Cards
Reason: MAC address is assigned by the manufacturer as a unique identifier of the device in a
network.
Answer: a

14. Assertion: Microwave is also a form of Radio wave


Reason: Wave having frequency less than 3GHz is called microwave.
Answer: b

15. Assertion: Radio wave signals are not effective in few cases.
Reason: Radio wave propagation is susceptible to weather effects like rain, thunderstorms etc.
Answer: a

Topic: Networking (Data Communication Terminologies)MLL


A. Match the following-
1.
Channel Carrying capacity of a Channel
Bps Bits per second
Baud Medium of Communication
Bps Bytes per second
Answer:
Channel- Medium of Communication
Bps- Bytes per second
Baud- Carrying capacity of a Channel
Bps- Bits per second
2.
HTTP Transferring files
FTP WWW
TCP/IP Sending emails
SMTP Base Communication Protocol
Answer:
HTTP- WWW
FTP- Transferring files
TCP/IP- Base Communication Protocol
SMTP- Sending emails
pg. 43
3.
Hub It creates dynamic connection and provides information to requesting
port only.
Switch It is dedicated for routing the network traffic
Router Broadcasts all data to every port and hence is less reliable
Answers:
Hub- Broadcasts all data to every port and hence is less reliable
Switch- It creates dynamic connection and provides information to requesting port only.
Router- It is dedicated for routing the network traffic
4. Read the following statements carefully and match whether it is about HTML or XML
(i) Both tag semantics and the tag set are fixed in it.
(ii) It facilitate defining the tags
(iii) It tells the browser that how to display the contents of a hypertext document
(iv) All the semantics is defined by the application or a style sheet
Answers:
(i) HTML
(ii) XML
(iii) HTML
(iv) XML

5. Read the following statements carefully and match whether it is about Client side scripting or
Server side scripting
(i) It is browser dependent
(ii) Script code is downloaded and executed at the client end
(iii) Affected by the processing speed of the host server
(iv) Services are secure as they do not have access to files and databases
(v) The script is executed at server side and the result is sent to client end
Answers:
(i) Client side scripting
(ii) Client side scripting
(iii) Server side scripting
(iv) Client side scripting
(v) Server side scripting

B. Fill in the blanks to complete the sentence from the given set of words.
(Script, cookies, cracker, TCP, IP, HTTPS, IMAP,POP3, telnet, SMTP)

PROTOCOL
1. __________ is a protocol that allows send/upload email message from local computer to an
email server.
2. __________ is like HTTP but a more secure protocol.
3. __________holds email message until user deletes it.
4. __________holds email message on the server until user downloads it.
5. In TCP/IP, the __________protocol is responsible for addressing.
6. In TCP/IP, the __________protocol is responsible for dividing message into multiple packets.
7. __________ protocol facilitates remote logic.
8. A __________ is a malicious hacker.
9. __________ are small text files saved by the website visited.
10. A__________ is a list of commands embedded in a webpage.

pg. 44
C. State whether the following statement are True or False
1. Firewall is a device/software that controls incoming and outgoing network traffic.
2. The HTTP and HTTPS are same protocols.
3. A cracker and a hacker technically do the same work.
4. 3G is an analogue netwotk.
5. POP3 is a protocol for sending files over internet
6. A LAN is a biggest network geographically.
7. A computer is identified by 64 bit IP address.
8. Every object on internet has a unique URL
9. MAC address is 48 bit address
10. LAN is the smallest network geographically.
Answer: 1. T 2. F 3. T 4. F 5. F 6. F 7. F 8. T 9. T 10. T

D. Short Answer: Write Full Forms of the following-


1. MAC-Media Access Control
2. NIC- Network Interface Card
3. P2P-Peer to Peer
4. TCP/IP-Transmission Control Protocol/Internet Protocol
5. URL-Uniform Resource Locater
6. WiFi-Wireless Fidelity
7. RJ-45-Registerd Jack-45
8. FTP-File Transfer Protocol
9. HTTPS-HyperText Transfer Protocol Secure
10. IMAP-Internet Message Access Protocol
11. POP3-Post Office Protocol3
12. SMTP-Simple Mail Transfer Protocol
13. GSM-Global system for Mobile
14. WLL-Wireless in Local Loop
15. GPRS-General Packet Radio Service
16. VoIP-Voice over internet protocol
17. DNS=Domain Name System Server
18. XML-Extensible Markup Language
19. DHTML-Dynamic HyperText Transfer Protocol
20. PPP-Point to point Protocol

Topic: Networking (Data Communication Terminologies)MCQ


1. Network in which very computer is capable of playing the role of a client, or a server or both
at same time is called
a) Peer to peer network b) local area network
c) dedicated server network d) wide area network
2. Which switching method offers a dedicated transmission channel?
a) Packet switching b) circuit switching c) message switching d) None of these
3. Which transmission media is capable of having a much higher bandwidth(data capacity)?
a) Coaxial b) Twisted pair cable c) untwisted cable d) Fiber optic
4. Which network topology requires a central controller or hub?
a) star b) bus c) None d) Tree
pg. 45
5. Hub is a -------
a) Broadcast device b) unicast device c) multicast device d) None of these
6. Network device that regenerates and retransmits the whole signal is --------.
a) Modem b) Hub c) Repeater d) Bridge
7. MODEM is
a) Modulation Demodulation b) Modulation Demanding
c) Modulator Demodulator d) Model Demodulator
8. Which device broadcast any data to all devices on a network?
a) Router b) Switch c) HUB d) Bridge
9. Which device filters data packets and only sends to those that require the data?
a) Router b) Switch c) HUB d) Bridge
10. Which protocol holds the email until you actually receive it?
a) POP3 b) IMAP c) SMTP d) FTP
Ans:-
1) a 2) b 3) d 4)a 5) a 6)c 7)c 8)c 9)b 10) a

Topic: Transmission Media and Network Devices

Q.1 Ethernet card is also known as


A) Network Interface Card b) LAN card c) Network Adaptor Card d) All of these
Answer: A) Network Interface Card
Q.2 It is a hardware device that allows communication between your local network
computers and other connected devices—and the internet
a) Switch b) Router c) Gateway d) Firewall
Answer: c) Gateway
Q.3 Mr Ketanraj wants to establish computer network in his cyber cafe, which of the following
device will be suggested by you to connect each computer in the cafe?
a) Switch b) Modem c) Gateway d) Repeater
Answer: a) Switch

Q.4 Which transmission medium is least susceptible to electromagnetic interference?


a) Twisted pair cable
b) Coaxial cable
c) Fiber optic cable
d) Radio wave

Answer: c) Fiber optic cable

Q.5 What is the primary advantage of fiber optic cables over copper cables?
a) Lower cost
b) Higher bandwidth and speed
c) Easier installation
d) Greater flexibility

Answer: b) Higher bandwidth and speed

Q.6 Which of the following is a type of unguided transmission medium?


a) Twisted pair cable
b) Fiber optic cable

pg. 46
c) Coaxial cable
d) Microwave
Answer: d) Microwave
Q.7 Which type of network uses Bluetooth technology?
a) LAN
b) MAN
c) WAN
d) PAN
Answer: d) PAN
Q.8 What is the maximum length of a Cat 5e Ethernet cable segment?
a) 10 meters
b) 50 meters
c) 100 meters
d) 200 meters
Answer: c) 100 meters
Q.9 Which network device regenerates and amplifies signals?
a) Router
b) Switch
c) Repeater
d) Hub
Answer: c) Repeater
Q. 10 Which type of cable is used to connect different types of devices, like a computer to a
switch?
a) Straight-through cable
b) Crossover cable
c) Coaxial cable
d) Fiber optic cable
Answer: a) Straight-through cable
Q. 11 What does the acronym WAP stand for in networking?
a) Wide Area Protocol
b) Wireless Access Point
c) Wired Access Point
d) Web Application Protocol
Answer: b) Wireless Access Point
Q.12 Which type of switching is used in the Internet?
a) Circuit switching
b) Packet switching
c) Message switching
d) Line switching
Answer: b) Packet switching

Q.13 What does the term "full-duplex" mean in networking?


a) Data can only be sent in one direction
b) Data can be sent in both directions, but not simultaneously
c) Data can be sent in both directions simultaneously
d) Data transmission is wireless
Answer: c) Data can be sent in both directions simultaneously
pg. 47
Q.14 Which of the following is not a guided transmission medium?
a) Twisted pair cable
b) Coaxial cable
c) Fiber optic cable
d) Radio wave
Answer: d) Radio wave

Q.15 What type of cable is most commonly used for cable television?
a) Twisted pair cable
b) Coaxial cable
c) Fiber optic cable
d) Ethernet cable
Answer: b) Coaxial cable

Q.16 Which transmission medium uses light signals to transmit data?


a) Twisted pair cable
b) Coaxial cable
c) Fiber optic cable
d) Radio wave
Answer: c) Fiber optic cable

Q.17 Which device is used to connect multiple networks and direct data packets between
them?
a) Hub
b) Switch
c) Router
d) Repeater
Answer: c) Router
Q.18 What does Wi-Fi stand for?
a) Wireless Fidelity
b) Wired Fidelity
c) Wireless Fiber
d) Wide Fidelity
Answer: a) Wireless Fidelity

Q.19 What is the main function of a network switch?


a) Amplify signals
b) Route data packets
c) Forward data based on MAC address
d) Convert digital signals to analog
Answer: c) Forward data based on MAC address

Q.20 What type of cable is commonly used in telephone networks?


a) Coaxial cable
b) Twisted pair cable
c) Fiber optic cable
d) Ethernet cable
pg. 48
Answer: b) Twisted pair cable

Topic: INTRO TO WEB SERVICES+ NETWORK TOPOLOGIES


Q.1. The topology with highest reliability is ?
(a) Bus topology (b) Star topology (c) Ring topology (d) Mesh topology
Q.2. In a star topology, message transmission in a switch will be __________
(a) Unicast (b) broadcast (c) Either Unicast or broadcast (d) None of the above
Q.3.Star topology is based on central device that can be __________?
(a) Hub (b) Switch (c) only a (d) Both a and b
Q.4. Security and Privacy are less in a _____________
(a) Bus (b) Mesh (c) Star (d) tree
Q.5. A network that contains multiple hubs is most likely configured in a _______ topology.
(a) Mesh (b) Bus (c) Star (d) Tree
Q.6. In a network with 25 computers , which topology would require the most expensive
cabling ?
(a) Star (b) Bus (c) Tree (d) Mesh
Q.7. Which network topology is considered passive ?
(a) Bus (b) Star (c) Ring (d) Tree
Q.8. The multipoint topology is ?
(a) Bus (b) Star (c) Ring (d) Mesh
Q.9. Computer network topology in which user connects each network node to a central
device hub is called ?
(a) Ring topology (b) Bus topology (c) Star topology (d) Mesh topology
Q.10. In a _________ topology , all the nodes are connected to a main central cable.
(a) Bus (b) Star (c) Tree (d) Ring

Q.11. In a _________ topology , the nodes of a network are connected to a central


hub/switch.
(a) Bus (b) Star (c) Tree (d) Ring

Q.12.Arranging of computers or nodes in a network is known as_____________


(a) Nodes (b) Network (c) Topology (d) All of the above

Q.13. What are the advantages of tree topology?


(a) Easy to maintain
(b) Easy to manage
(c) Node expansion is easy and fast
(d) All of the above

Q.14. URL expands to


(a) Uniform Rate Line (b) Universal Resource Line
(c) Universal Resource Locator (d) Uniform Resource Locator

Q.15.The new web standard that incorporates AI, ML and block chain to the internet
is__________
(a) Web 1.0 (b) Web 2.0 (c) Web 3.0 (d) Web 4.0

pg. 49
Q.16.Which of the following are automatically loaded and operates as a part of browser?
a) Add-ons
b) Plug-ins
c) Utilities
d) Widgets

Q.17. Which of the following allows user to view a webpage?


a) Operating System
b) Website
c) Interpreter
d) Internet Browser

Q.18. Which of the following is not a web server?


a) Apache tomcat
b) BlueGriffon
c) Jetty
d) Tornado

Q.19. Which of the following is the first web browser?


a) Nexus
b) Netscape Navigator
c) Internet Explorer
d) Mosaic

Q.20.Which of the following is used to read a HTML page and render it?
a) Web browser
b) Web server
c) Web matrix
d) Web network
ASSERTION & REASONING

ASSERTION & REASON TYPE QUESTIONS Directions: In the following questions, A statement
of Assertion (A) is followed by a statement of Reason(R).

Mark the correct choice as.


A. Both A and R are true and R is the correct explanation for A.
B. Both A and R are true and R is NOT correct explanation for A.
C. A is true but R is false.
D. A is false but R is true.

1. Assertion (A): TCP/IP (Transmission Control Protocol/Internet Protocol) is the base


communication protocol of the Internet.
Reason (R): IP part of TCP/IP uses numeric IP addresses to join network segments and TCP
part of TCP/IP provides reliable delivery of messages between networked computers.

Ans. Option (A) is correct.

2. Assertion (A): The microwave transmission is a line of sight transmission.


pg. 50
Reason (R): Microwave signals travel at a higher frequency than radio waves.

Ans. Option (B) is correct.

3. Assertion (A): Client-Server network is a dedicated network.


Reason (R): The server in client-server network perform no other tasks besides network
services.

Ans. Option (A) is correct.

4. Assertion (A): IP addresses are very important for communication.


Reason (R): It identifies a device on the network.

Ans. Option (A) is correct.

5. Assertion (A): A router is more powerful and intelligent than hub or switch.
Reason (R): It has advanced capabilities as it can analyses the data and decide the data is
packed and send it to the other network.

Ans. Option (A) is correct.

6. Assertion (A): The repeater is a device that amplifies the network over geographical
distance.
Reason (R): A hub is a device which is used to connect more than one device in the network.

Ans. Option (B) is correct.

7. Assertion (A): VoIP stands for Voice over Internet Protocol.


Reason (R): It is a technology that allows you to make voice calls using a broadband internet
connection instead of a regular phone line.

Ans. Option (A) is correct.

8. Assertion (A): A protocol means the rules that are applicable for a network.
Reason (R): Local Area Network is an example of protocol.

Ans. Option (C) is correct

9. Assertion (A): Short Message Service (SMS) is the transmission of short text messages to
and from a mobile phone, fax machine and/or IP address.
Reason (R): Messages must be no longer than some fixed number of alpha-numeric characters
and contain no images or graphics.

Ans. Option (A) is correct.

10. Assertion (A): A hub is a networking device used to create LAN.


Reason (R): A hub is a device that is used to segment networks into different sub networks.
pg. 51
Ans. Option (C) is correct.

11. Assertion (A): Routers transmit data in more efficient way.


Reason (R): Routers maintains a routing table.
Ans. Option (A) is correct.

12. Assertion (A): The web is the common name for the World Wide Web, a subset of the
Internet consisting of the pages that can be accessed by a web browser.
Reason (R): URL is a unique identifier used to locate a resource on the Internet.

Option (B) is correct.

13. Assertion (A): Static Webpage contains content that do not change or not capable of
typing in new data.
Reason (R): They may only change if the actual HTML file is manually edited.

Ans. Option (A) is correct.

14. Assertion (A): File Transfer Protocol is a standard for the exchange of files across
internet.
Reason (R): Files of any type can be transferred, whether the file is an ASCII or binary file.

Ans. Option (A) is correct.

15. Assertion (A): GSM refers to Global System for Mobile communications. It is a technique
that uses narrowband TDMA (Time Division Multiple Access), which allows eight
simultaneous calls on the same radio frequency.
Reason (R): TDMA technology uses time-division multiplexing (TDM) and divides a radio
frequency into time slots and then allocates these slots to multiple calls thereby supporting
multiple, simultaneous data channels.

Ans. Option (A) is correct.

Topic :Data Communication Terminologies


1. Which switching method offers a dedicated transmission channel ?
(a) Packet switching (b) Circuit switching (c) Message switching (d) None of these
2. The packets in ________ are independently sent, meaning that they can take different
paths through the network to reach their intended destination
(a) Packet switched (b) Circuit switched (c) Message switched (d) None of these
3. A local telephone network is an example of a _____________network
(a) Packet switched (b) Circuit switched (c) Message switched (d) None of these
4. The term IPv4 stands for ?
(a) Internet protocol version 4
(b) Internet programming version 4
(c) International programming version 4
(d) None of these
pg. 52
5. How many versions available of IP address?
(a) 6 versions (b) 4 versions (c) 2 versions (d) 1 version
6. Which of the following is correct IPv4 address?
(a) 124.201.3.1.52
(b) 300.142.210.64
(c) 1011011.42.11.9
(d) 128.64.0.0
7. The length of IPv6 address is
(a) 32 bits (b) 64 bits (c) 128 bits (d) 256 bits
8. _______ is defined as the rate of change of signal on transmission medium after
encoding and modulation have occurred.
(a) Cyclic rate (b) Pulse rate (c) Bit rate (d) Baud rate
9. In which of the following switching methods, the message is divided into small packets?
(a) Message switching (b) Packet switching (c) Virtual Switching (d) None of these
10. Which of the following switch methods creates a point-to-point physical connection
between two or more computers?
(a) Message switching (b)Packet switching (c) Circuit switching (d) None of these

Answer
1. (b) Circuit switching
2. (a) Packet switched
3. (b) Circuit switched
4. (a) Internet protocol version 4
5. (c) 2 versions
6. (d) 128.64.0.0
7. (c) 128 bits
8. (d) Baud rate
9. (b) Packet switching
10.(c) Circuit switching

MCQ
1 Two-way transmission in which ALL connected devices are transmitting AND receiving
information SIMULTANEOUSLY.
(a)Simplex (b)Full Duplex
(C) LAN Architecture (d)Multiple Devices
Ans:- (b)Full Duplex
2 It is usually privately owned network infrastructure which covers and connects different
devices in a single office, building or campus.
(a)Local Area Network (b)Internet
(c) Personal Area Network (d)Wide Area Network
Ans:- (a)Local Area Network
3 One-way transmission in which each device is either transmit OR receive ONLY.
(a)Half Duplex (b)Firewall
(c) Simplex (d) Ethernet
Ans:- (c) Simplex
4 A network device which extends the range of a signal by receiving then regenerating it and
sending out all other ports.
(a)Repeater (b)Hub
(c)Switch (d)Router
pg. 53
Ans:- (a)Repeater
5 A network security tool used to filter and block unauthorize traffic based on the policies
implemented by the organization.
(a)Router (b)Hub
(c)Firewall (d)Proxy Server
Ans:- (c)Firewall
6 Defines the capability of the network to adapt to change and flexibility to have expansion in
the long run.
(a)Security (b)Scalability
(c)Reliability (d)Availability
Ans:- (b)Scalability
7 Measured by the frequency of failure or the time it takes a link to recover from an outage.
(a)Security (b)Scalability
(c)Reliability (d)Availability
Ans:- (c)Reliability
8 Type of topology which end devices are connected centrally on a hub, also known as "hub-
and-spoke" topology.
(a)Star Topology (b)Mesh Topology
(c)Ring Topology (d)Bus Topology
Ans:- (a)Star Topology
9 A glass or plastic strand that transmits information using light and is made up of one or more
optical fibers.
(a)Twisted Pair Cabling (b)Ethernet
(c)Coaxial Cable (d)Fiber-Optic Cables
Ans:- (d)Fiber-Optic Cables
10 Type of topology where one long cable acts as a backbone to link all the devices in a
network.
(a)Star Topology (b)Mesh Topology
(c)Ring Topology (d)Bus Topology
Ans:- (d)Bus Topology
11 A ________ is a set of rules that governs data communication.
(a)Forum (b)Protocol
(c)Standard (d)None of these
Ans:- (b)Protocol
12 Network in which every computer is capable of playing the role of a client or a server or both
at same time is called
(a)peer-to-peer network (b)local area network
(c)dedicated server network (d)wide area network
Ans:- (a)peer-to-peer network
13 Transmission media are usually categorized as __________
(a) fixed or unfixed (b)determinate or indeterminate.
(c)guided or unguided (d) metallic or nonmetallic.
Ans:- (c)guided or unguided
14 Which of the following primarily uses guided media?
(a)Cellular telephone system (b)Local telephone system
(c)Satellite Communications (d)Radio broadcasting
Ans:- (b)Local telephone system
15 The internetworking protocol is known as
(a)SMTP (b)PPP
(c)TCP/IP (d)NNTP

pg. 54
Ans:- (c)TCP/IP
16 Internet is an example of ____________ topology
(a)Star topology (b)Bus topology
(c)Mesh topology (d)Tree topology
Ans:- (c)Mesh topology
17 _____ Address is assigned to network cards by the manufacturer.
(a)IP (b)MAC (c)Unique (d)domain
Ans:- (b)MAC
18 FTP stands for
(a)File transfer Policy (b)File transfer Protocol
(c)File transmission Protocol (d)File transmission policy
Ans:- (b)File transfer Protocol
19 Which of the following is not a guided communication medium?
(a)Twisted pair cable (b)Microwave
(c)Coaxial cable (d)Optical fibre
Ans:- (b)Microwave
20 What is the size of MAC address?
(a)16 bits (b)32 bits (c)48 bits (d)64 bits
Ans:- (c)48 bits

Topic: Transmission media +network device (5 Marks)

1. Galaxy Provider Ltd. is planning to connect its office in Texas, USA with its branch at Mumbai.
The Mumbai branch has 3 Offices in three blocks located at some distance from each other
for different operations –ADMIN, SALES and ACCOUNTS.
As a network consultant, you have to suggest the best network related solutions for the
issues/problems raised in (a) to (d), keeping in mind the distances between various locations
and other given parameters.

Number of Computers installed at various locations are as follows:


ADMIN Block 255
ACCOUNTS Block 75
SALES Block 30
pg. 55
TEXAS Head Office 90

Q i It is observed that there is a huge data loss during the process of data transfer from one
block to another. Suggest the most appropriate networking device out of the following, which
needs to be placed along the path of the wire connecting one block office with another to
refresh the signal and forward it ahead.
(i) MODEM (ii)ETHERNETCARD
(iii) REPEATER (iv) HUB
Ans:- iii

Qii. Which hardware networking device out of the following, will you suggest to connect all
the computers within each block ?
(i) SWITCH (ii) MODEM
(iii) REPEATER (iv) ROUTER
Ans:- (i)
Qiii. Which service/protocol out of the following will be most helpful to conduct live
interactions of employees from Mumbai Branch and their counterparts in Texas?
(i) FTP (ii) PPP
(iii) SMTP (iv)VoIP
Ans (iv)
Qiv. Draw the cable layout (blocktoblock) to efficiently connect the three offices of the
Mumbai branch.
Ans:

2. Aryan Infotech Solutions has set up its new center at Kamla Nagar for its office and web
based activities. The company compound has 4 buildings as shown in the diagram below:

Building to Orbit Building. 50 Mtrs

pg. 56
Orbit Building to Oracle Building 85 Mtrs
Oracle Building to Sunrise Building 25 Mtrs.

Sunrise Building to Jupiter Building 170 Mtrs.

Jupiter Building to Oracle Building 125 Mtrs.

Orbit Building to Sunrise Building 45 Mtrs.


Number of Computers in each of the buildings is follows:
Jupiter Building 30
Orbit Building 150
Oracle Building 15
Sunrise Building 35
i) Suggest a cable layout of connections between the buildings.
ii) Suggest the most suitable place (i.e. building) to house the server of this organisation with
a suitable reason
iii) Suggest the placement of the following devices with justification:
a. Internet Connecting Device/Modem
b. Switch
iv) The organisation is planning to link its sale counter situated in various parts of the same
city, which type of network out of LAN, MAN or WAN will be formed? Justify your answer.
v) What do your mean by PAN? Explain giving example.
Ans:-
i) suggest a cable layout of connections between the buildings:-

ii) Orbit Building


iii)a. Internet Connecting Device/Modem- Orbit Building
b. Switch- Each Building
iv) MAN, it is formed to connect various locations of the city via various communication
media.

3. Magnolia Infotech wants to set up their computer network in the Bangalore based campus
having four buildings. Each block has a number of computers that are required to be
connected for ease of communication, resource sharing and data security. You are required
to suggest the best answers to the questions i) to v) keeping in mind the building layout on
the campus.

pg. 57
Distance Between the various blocks
Block Distance
Development to HR 50m
Development to Admin 75m
Development to Logistics 120m
HR to Admin 110m
HR to Logistics 50m
Admin to Logistics 140m
i) Suggest the most appropriate block to host the Server. Also justify
your choice.
ii) Suggest the device that should be placed in the Server building so that they can connect to
Internet Service Provider to avail Internet Services.
iii) Suggest the wired medium and draw the cable block to block layout to economically
connect the various blocks.
iv) Suggest the placement of Switches and Repeaters in the network
with justification.
v) Suggest the high-speed wired communication medium between
Bangalore Campus and Mysore campus to establish a data network
Ans:-
i) Admin Block since it has maximum number of computers.
ii) Modem should be placed in the Server building
iii) The wired medium is UTP/STP cables.

iv) Switches in all the blocks since the computers need to be connected to the network.
Repeaters between Admin and HR block & Admin and Logistics block. The reason being the
distance is more than 100m.
v) Optical Fiber cable connection

pg. 58
4. MakeInIndia Corporation, an Uttarakhand based IT training company, is planning to set up
training centres in various cities in next 2 years. Their first campus is coming up in Kashipur
district. At Kashipur campus, they are planning to have 3 different blocks for App
development, Web designing and Movie editing. Each block has number of computers, which
are required to be connected in a network for communication, data and resource sharing. As
a network consultant of this company, you have to suggest the best network related solutions
for them for issues/problems raised in question nos. (i) to (v), keeping in mind the distances
between various Distance between various blocks/locations:

(i) Suggest the most appropriate block/location to house the SERVER in the Kashipur campus (out
of the 3 blocks) to get the best and effective connectivity. Justify your answer.

(ii) Suggest a device/software to be installed in the Kashipur Campus to take care of data security.
(iii) Suggest the best wired medium and draw the cable layout (Block to Block) to economically
connect various blocks within the Kashipur Campus.
(iv) Suggest the placement of the following devices with appropriate reasons:
a Switch / Hub
b Repeater
(v) Suggest a protocol that shall be needed to provide Video Conferencing solution between
Kashipur Campus and Mussoorie Campus.

Ans:-
i) Movie editing block is the most appropriate to house the server as it has the maximum
number of computers.
Ii) Firewall
iii) (iii) Ethernet Cable
(iv)Repeater is not required between the blocks as the distances are less than 100 mts.
(v) Protocol: VoIP

5. An International Bank has to set up its new data center in Delhi, India. It has 5 five blocks
of buildings - A, B, C, D and E.

pg. 59
Distance between the blocks and number of computers in each block areas given below:-
Distance Between Blocks No of Computers
Block B to Block C 30m Block A 55
Block C to Block D 30m Block B 180
Block D to Block E 35m Block C 60
40m 55
Block E to Block C Block D
120m 70
Block D to Block A Block E
45m
Block D to Block B
65m
Block E to Block B

(i) Suggest the most sultadle block to host the server. Justify your answer
(ii) Draw the cable layou slock to Block) to economically connect various blocks within the
Delhi campus of International Bank.
(iii) Suggest the placement ot the following devices with justification:
(a) Repeater
(b) Hub/Switch
(iv)The bank is planning to connect its head office in London. Which type of network out of
LAN, MAN, or WAN will be formed? Justify your answer.
(v) Suggest a device/software to be installed in the Delhi Campus to take care of data security.

pg. 60
6. Ravya Industries has set up its new center at Kaka Nagar for its office and web based
activities. The company compound has 4 buildings as shown in the diagram below:

(i) Suggest a cable layout of connections between the buildings.


(ii) Suggest the most suitable place(i.e. building) to house the of this organization with a
suitable reason.

(iii) Suggest the placement of the following devices with appropriate reasons:
a) Hub/Switch
b)Repeater
(iv) The organisation is planning to link ints sale counter situated in various parts of the same
city, which type of network out of LAN, MAN or WAN will be formed?
(v) Suggest a device/software to be installed in the Campus to take care of data security.
Ans:-
(i) Any one of the following

(ii) The most suitable place / block to house the server of this organisation would be Raj
Building, as this block contains the maximum number of computers, thus decreasing the
cabling cost for most of the computers as well as increasing the efficiency of the maximum
computers in the network.

(iii)
(a) Switch/hub will be placed in all blocks to have connectivity within the block.
(b) Repeater is not required between the blocks as the distances are less than 100 mts.

(iv) MAN, because MAN (Metropolitan Area Networks) are the networks that link computer
facilities within a city.
(v) Firewall

7. 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
pg. 61
to understand their requirement and suggest them the best available solutions. Their queries
are mentioned as (i) to (v) below.

a) Which will be the most appropriate block, where TTC should plan to install their 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 Bengalore with its London based office.
● Satellite Link
● Infrared
● Ethernet
d) Which of the following device will be suggested by you to connect each computer in each
of the buildings?
● Switch
● Modem
● Gateway
e) Company is planning to connect its offices in Hyderabad which is less than 1 km. Which
type of network will be formed?
Ans:-
(i) TTC should install its server in finance block as it is having maximum number of computers.
(ii) The layout is based on minimum cable length required, which is 120 metres in the above
case.

(iii) Satellite Link.


(iv) Switch.
(v) LAN

8. A company ABC Enterprises has four blocks of buildings as shown

pg. 62
Computer sin each block are net worked but blocks are not networked. The company has
now decided to connect the blocks also.
(i) Suggest the most appropriate topology for the connections between the blocks.
(ii) The company wants internet accessibility in all the blocks. The suitable and cost-effective
technology for that would be?
(iii)Which devices will you suggest for connecting all the computers with in each of their
blocks.
(iv)The company is planning to link its head office situated in New Delhi with the offices in
hilly areas. Suggest a way to connect it economically.
(v) Suggest the most appropriate location of the server, to get the best connectivity for
maximum number of computers.

Ans:-
(i)star
(ii)Broadband
(iii)Switch/Hub
(iv)RadioWave
(v)Block B1

9. FutureTech Corporation, a Bihar based IT training and development company, is planning


to set up training centers in various cities in the coming year. Their first center is coming up
in Surajpur district. At Surajpur center, they are planning to have 3 different blocks - one for
Admin, one for Training and one for Development. Each block has number of computers,
which are required to be connected in a network for communication, data and resource
sharing. As a network consultant of this company, you have to suggest the best network
related solutions for them for issues/problems raised in question nos. (i) to (v), keeping in
mind the distances between various blocks/locations and other given parameters.
pg. 63
(i) Suggest the most appropriate block/location to house the SERVER in the Surajpur center
(out of the 3 blocks) to get the best and effective connectivity. Justify your answer.
(ii) Suggest why should a firewall be installed at the Surajpur Center?
(iii) Suggest the best wired medium and draw the cable layout(Block to Block) to most
efficiently connect various blocks within the Surajpur Center.
(iv) Suggest the placement of the following devices with appropriate reasons:-
(a) Switch/Hub
(b) Router
(v) Suggest the best possible way to provide wireless connectivity between Surajpur Center
and Raipur Center.
Ans:-
i) Development because it contains more number of computers
ii) Surajpur centre has multiple blocks and firewall ensures security. So it is required. It allows
or block unwanted attacks.
iii)

iv) a) Switch/Hub- In every block to interconnect he devices within every block


b) Router-In development block because server is going to be place here
v) Satellite

pg. 64
10. 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. 5
You as a network expert have to suggest the best network related solutions for their
problems raised in (i) to (v), keeping in mind the distances between the buildings and other
given parameters.

(i) 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.
(ii) Suggest and draw the cable layout to efficiently connect various buildings within the
CHENNAI campus for connecting the computers.
(iii) 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 ?
(iv) 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
(v) Name protocols used to send and receive emails between CHENNAI and DELHI office?
Ans:-
pg. 65
(i)admin; it contains the max number of systems. to reduce traffic
(ii)

(iii)firewall
(iv) (c) Video Conferencing
(v) POP and SMTP

11. Quick Learn University is setting up its academic blocks at Prayag Nagar and Planning to
set up network. The university has 3 academic blocks and one human resource Centre as
shown in the
diagram given below:

(a) Suggest a cable layout of connection between the blocks.


(b) Suggest the most suitable place to house the server of the organization with suitable
reason.
(c) Which device should be placed/installed in each of these blocks to efficiently connect all
the computers within these blocks?
(d) The university is planning to link its sales counters situated in various parts of the CITY.
Which type of network out of LAN, MAN or WAN will be formed?
(e) Which network topology may be preferred between these blocks?
Ans:-
(a) Suggest a cable layout of connection between the blocks.

pg. 66
(b) HR centre because it consists of the maximum number of computers to house the
server.
(c) Switch/ Hub should be placed in each of these blocks.
(d) MAN
(e) Bus

12. Rehaana Medicos Center has set up its new center in Dubai. It has four buildings as
shown in the diagram given below:

As a network expert, provide the best possible answer for the following queries:
i) Suggest a cable layout of connections between the buildings.
ii) Suggest the most suitable place (i.e. buildings) to house the server of this organization.
iii) Suggest the placement of the Repeater device with justification.
iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the
network.
(v) Suggest the placement of the Hub/ Switch with justification.

Ans:-
(i) 1 Mark for correct Layout.
(ii) Research Lab ( 1 Mark)
(iii) 1 Mark for correct Justification.
(iv) Antivirus/ Firewall (1 Mark for Correct Answer)
(v) 1 Mark for correct Justification

pg. 67
13. “VidyaDaan” an NGO is planning to setup its new campus at Nagpur for its web-based
activities. The campus has four(04) UNITS as shown below:

i) Suggest an ideal cable layout for connecting the above UNITs.


ii) Suggest the most suitable place i.e. UNIT to install the server for the above
iii) Which network device is used to connect the computers in all UNITs?
iv) Suggest the placement of Repeater in the UNITs of above network.
v) NGO is planning to connect its Regional Office at Kota, Rajasthan. Which out of
the following wired communication, will you suggest for a very high-speed
Connectivity ?
(a) Twisted Pair cable (b) Ethernet cable (c) Optical Fiber
Ans:- i. Layout

ii. Admin
iii. SWITCH/HUB
iv. ADMIN & FINANCE
v. (c) Optical Fiber

pg. 68
14. India Tech Solutions (ITS) 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 as (i) to (v) below.
Physical locations of the blocks of TTC:-

(i)Which will be the most appropriate block, where TTC should plan to install their server?
(ii) Draw a block to block cable layout to connect all the buildings in the most appropriate
manner for efficient communication.
(iii)What will be the best possible connectivity out of the following, you will suggest to
connect the new set up of offices in Bengalore with its London based office.
• Satellite Link
• lInfrared
• Ethernet
(iv) Which of the following device will be suggested by you to connect each computer in
each of the buildings?
• Switch
• Modem
• Gateway
(v) Company is planning to connect its offices in Hyderabad which is less than 1 km. Which
type of network will be formed?
Ans:
(i) TTC should install its server in finance block as it is having maximum number of
computers.
(ii) Any suitable lyout
(iii) Satellite Link.
(iv) Switch.
(v) LAN

15. Total-IT Corporation, a Karnataka based IT training company, is planning to set up training
centers in various cities in next 2 years. Their first campus is coming up in Kodagu district. At

pg. 69
Kodagu campus, they are planning to have 3 different blocks, one for AI, IoT and DS (Data
Sciences) each. Each block has number of computers, which are required to be connected in
a network for communication, data and resource sharing. As a network consultant of this
company, you have to suggest the best network related solutions for them for
issues/problems raised in question nos. (i) to (v), keeping in mind the distances between
various blocks/locations and other given parameters.

(i) Suggest the most appropriate block/location to house the SERVER in the Kodagu campus
(out of the 3 blocks) to get the best and effective connectivity. Justify your answer.
(ii) Suggest a device/software to be installed in the Kodagu Campus to take care of data
security.
(iii) Suggest the best wired medium and draw the cable layout (Block to Block) to most
efficiently connect various blocks within the Kodagu Campus.
(iv) Suggest the placement of the following devices with appropriate reasons:
a) Switch/Hub b) Router
(v) Suggest a protocol that shall be needed to provide Video Conferencing solution between
Kodagu Campus and Coimbatore Campus.

Ans:-
i) IoT block, as it has the maximum number of computers
ii) Firewall
iii) Optical fiber

iv ) a) Switch/Hub: In each block to interconnect the computers in that block.


b) Router: In IoT block (with the server) to interconnect all the three blocks.
pg. 70
v) VOIP(Voice over internet protocol)

Short answer types questions(2 Marks)


Q.1 Write the disadvantage of Twisted Pair over Coaxial Cable
Q.2 Which unguided transmission media is required to be in line-of-sight distance?
(a) Radio Wave (b) Satellite (c) Micro Wave (d) All of the above
Q.3 Write two points of differences between Switch and Hub.
Q.4 What is the use of Bridge in a Network?
Q.5 Explain in brief about Modem.
Q.6 Differentiate between Switch and Router.
Q.7 Differentiate between Hub and Repeater.
Q.8 It is a hardware device that allows communication between your local network
computers and other connected devices—and the internet
a)Switch b) Router c) Gateway d) Firewall
Q.9 State True/False: A Modem converts digital data from a computer or other device into
an analog signal that can be sent over standard telephone lines
Q.10 How Router differ from Modem?
Q.11 Describe types of Hub in brief.
Q.12 Write two disadvantages of unguided media.
Q.13 Write two benefits of use of guided media.
Q.14 What is the bridge Networking device? How they differ from repeater?
Q.15 What is role of a switch in network devices?
DATABASE MANAGEMENT
Short Answers type questions MLL
1. What is SQL join?
Ans:-A SQL join is an query used within the SQL to combine data from two tables on the basis of a
common field.
2. What is Natural Join?
Ans:- A NATURAL JOIN is a join operation that creates an implicit join clause for you based on the
common columns in the two tables being joined. Common columns are columns that have
the same name in both tables.
3. What is Equi-Join?
Ans:-An Equi-join is a sql join where we use the equal sign as the comparison operator ie ‘=’
between two tables while specifying the join condition e.g
SELECT * FROM EMP E,DEPT D WHERE E.DEPTNO=D.DEPTNO.
4. The operation whose result contains all pairs of tuples from the two relations, regardless of
whether their attribute values match.
a. Join b. Cartesian Product c. Intersection d. Set difference
Ans:- [ b ]
5. The following SQL in which type of join :-
SELECT CUSTOMER.CUST_ID,ORDER.CUST_ID,ORDER_ID
FROM CUSTOMER,ORDER
WHERE CUSTOMER.CUST_ID=ORDER.ORDER_ID:
a. Equi-Join b. Natural Join c. Outer join d. Cartesian product
pg. 71
Ans:- [ a ]
6. The following SQL in which type of join:
SELECT CUSTOMER.CUST_ID,ORDER.CUST_ID,ORDER_ID
FROM CUSTOMER,ORDER;
a. Equ-join b. Natural-join c. Outer join d. Cartesian Product
Ans:- [ d ]
7. Which product is returned in a join query have no join condition?
a. Equi-join b. Cartesian Product c. Both (a) and (b) d. None of the mentioned
Ans:-[ b ]
8. Which is a join condition an equality operator?
a. Equi-join b. Cartesian Product c. Both (a) (b) d. None of the mentioned
Ans:- [ a ]
9. To get data from two or more tables having some common fields, ----------- query is created.
Ans :[ join ]
10. In qui-join, the join condition joins the two tables using ----------- operator.
Ans: [ = ]
DATABASE MANAGEMENT MCQ

1 What is the primary purpose of database management?


a) To design user interfaces for applications
b) To efficiently store, organize, and manage data
c) To develop computer networks
d) To optimize website performance
Answer: b) To efficiently store, organize, and manage data
2 Which aspect of database management ensures that data is accurate, consistent, and
reliable?
a) Data Modeling
b) Data Security
c) Data Integrity
d) Data Retrieval
Answer: c) Data Integrity
3 Which type of database management system stores data in tables with rows and columns?
a) Hierarchical Database
b) Relational Database
c) NoSQL Database
d) Object-Oriented Database
Answer: b) Relational Database
4 Which statement is true about primary keys in a database?
a) Primary keys are used for data encryption
b) Primary keys are used for data indexing
c) Primary keys uniquely identify each record in a table
d) Primary keys are used for data backup
Answer: c) Primary keys uniquely identify each record in a table
5 In the context of database management, what is the purpose of a foreign key?
a) To store binary data such as images or videos
b) To establish a link between two or more database tables
c) To prevent unauthorized access to the database
d) To improve data retrieval speed
pg. 72
Answer: b) To establish a link between two or more database tables
6 A Database Management System (DBMS) is
a) Collection of interrelated data
b) Collection of programs to access data
c) Collection of data describing one particular enterprise
d) All of the above
Ans: - a) Collection of interrelated data
7 In mathematical term Table is referred as
a) Relation
b) Attribute
c) Tuple
d) Domain
Ans: - a) Relation
8 Which of the following in true regarding Referential Integrity?
a) Every primary-key value must match a primary-key value in an associated table
b) Every primary-key value must match a foreign-key value in an associated table
c) Every foreign-key value must match a primary-key value in an associated table
d) Every foreign-key value must match a foreign-key value in an associated table
Ans: - c) Every foreign-key value must match a primary-key value in an associated table
9 Which of the following places the common data elements in order from smallest to largest
a) character, file, record, field, database
b) character, record, field, database, file
c) character, field, record, file, database
d)Bit, Byte, character, record, field, file, database
Ans: - c) character, field, record, file, database
10 When data changes in multiple lists and all lists are not updated, this causes
a) data redundancy
b) information overload
c)duplicate data
d)data inconsistency
Ans: - d) data inconsistency
11 Consider the following SQL statement. What type of statement is this?
CREATE TABLE employee (name VARCHAR, id INTEGER)
(a) DML (b) DDL
(c) DCL (d) Integrity constraint
12 In the given query which keyword has to be inserted?
INSERT INTO student______(1002, “Kumar”, 2000);
(a) Table (b) Values
(c) Relation (d) Field

13 Which of the following group functions ignore NULL values?


(a) MAX (b) COUNT
(c) SUM (d) All of the above
14 Where and Having clauses can be used interchangeably in SELECT queries?
(a) True (b) False
c) Only in views (d) With order by

pg. 73
Assertion & Reasoning
1. Assertion (A) : The 'GROUP BY' clause in SQL is used to aggregate data based on specified
columns.
Reasoning (R ) : The 'GROUP BY' clause is used to group rows that have the same values in
specified columns, often used in conjunction with aggregate functions like SUM, COUNT,
AVG, etc., to perform operations on grouped data.
Answer R is the correct explanation of A

2. Assertion(A): The primary key uniquely identifies each record in a table.


Reasoning(A): The primary key constraint ensures that each row in a table is uniquely
identified, preventing duplicate records and ensuring data integrity.
Answer R is the correct explanation of A

3. Assertion( A) : Natural join can lead to ambiguous column names in the result.
Reason ( R) : Natural join automatically joins tables using columns with the same names.
Answer A is True but R is False

pg. 74
Topic: Python Mysql Connectivity
Q.1.In order to open a connection with MySQL database from within Python using
mysql.connector package, ............... function is used.
1. open()
2. database()
3. connect()
4. connectdb()
Answer
connect()
Reason — The connect() function of mysql.connector is used for establishing connection to
a MYSQL database.
Q.2.A database ............... controls the connection to an actual database, established from
within a Python program.
1. database object
2. connection object
3. fetch object
4. query object
Answer
connection object
Reason — A database connection object controls the connection to the database. It
represents a unique session with a database connected from within a script/program.
Q.3The set of records retrieved after executing an SQL query over an established database
connection is called ............... .
1. table
2. sqlresult
3. result
4. resultset
Answer
resultset
Reason — The result set refers to a logical set of records that are fetched from the database
by executing an SQL query and made available to the application program.
Q.4 A database ............... is a special control structure that facilitates the row by row
processing of records in the resultset.
1. fetch
2. table
3. cursor
4. query
Answer
cursor
Reason — A database cursor is a special control structure that facilitates the row by row
processing of records in the resultset, i.e., the set of records retrieved as per query.
Q.5Which of the following is not a legal method for fetching records from database from
within Python?
1. fetchone()
2. fetchtwo()

pg. 75
3. fetchall()
4. fetchmany()
Answer
fetchtwo()
Reason — The fetchall() method, fetchmany() method, or fetchone() method are the legal
methods used for fetching records from the result set.
Q.6 To obtain all the records retrieved, you may use <cursor>. ............... method.
1. fetch()
2. fetchmany()
3. fetchall()
4. fetchmultiple()
Answer
fetchall()
Reason — The <cursor>.fetchall() method will return all the rows from the resultset in the
form of a tuple containing the records.
Q.7 To fetch one record from the resultset, you may use <cursor>. ............... method.
1. fetch()
2. fetchone()
3. fetchtuple()
4. none of these
Answer
fetchone()
Reason — The <cursor>.fetchone() method will return only one row from the resultset in
the form of a tuple containing a record.
Q.8 To fetch multiple records from the resultset, you may use <cursor>. ............... method.
1. fetch()
2. fetchmany()
3. fetchmultiple()
4. fetchmore()
Answer
fetchmany()
Reason — The <cursor>.fetchmany(<n>) method will return only the <n> number of rows
from the resultset in the form of a tuple containing the records.
Q.9 To run an SQL query from within Python, you may use <cursor>. ............... method().
1. query()
2. execute()
3. run()
4. all of these
Answer
execute()
Reason — The <cursor>.execute() method is used to run an SQL query from within Python.
Q.10 To reflect the changes made in the database permanently, you need to run
<connection>. ............... method.
1. done()
2. reflect()
3. commit()
4. final()
Answer
commit()

pg. 76
Reason — The <connection>.commit() method is used to permanently reflect the changes
made in the database when working with database connections in Python.

Topic: Interface of Python with MySQL

1. To open a connector to Mysql database, which statement is used to connect with mysql?
(a) Connector
(b) Connect
(c) password
(d) username
2. Which connector is used for linking the database with Python code?
(a) MySQL-connector
(b) YesSQL: connector
(c) PostSQL: connector
(d) None of the above
3. Which method of cursor class is used to fetch limited rows from the table?
(A) cursor.fetchsize(SIZE)
(B) cursor.fetchmany(SIZE)
(c) cursor.fetchall(SIZE)
(D) cursor.fetchonly(SIZE)
4. Which method of cursor class is used to insert or update multiple rows using a single
Query?
(A) cursor.executeall(query,rows)
(B) cursor.execute(query,rows)
(C) cursor.executemultiple(query,rows)
(D) cursor.executemany(query,rows)
5. Which method of cursor class is used to get the number of rows affected after any of the
Insert/update/delete database operation executed from Python?
(A) cursor.rowcount
(B) cursor.getaffectedcount

pg. 77
(C) cursor.rowscount
(D) cursor.rcount
6. Which of the following is not a legal method for fetching records from database?
a) fetchone()
b) fetchtwo()
c) fetchall()
d) fetchmany()
7. To reflect the changes made in the database permanently you need to run……..
a) done()
b) reflect()
c) commit()
d) final
8. A database …………..controls the connection to an actual database , established in program.
a) database object
b) connection object
c) fetch object
d) query object
9. which method is used to retrieve N number of records
A. fetchone()
B. fetchall()
C. fetchmany()
D. fetchN()
10. In python, execute() method can execute only ________ .
A. Only DQL & DML statements
B. Only DML statements
C. Only DQL statements.
D. DDL, DML & DQL statements.

Topic: Interface of Python with MySQL

Q.1 To establish a connection between Python and SQL database, connect() method is
used. Identify the correct syntax of connect( ) method from the followings.
(A) Connect(user=”user name”, passwd=”password”, host=”host name”, database=
“database name”)

pg. 78
(B) Connect(host=”host name”, user=”user name”, password=”password”, database=
“database name”)
(C) Connect(host=”host name”, user=”user name”, passwd=”password”, database=
“database name”)
(D) Connect(host=”host name”, database= “database name”, user=”user name”,
password=”password”)

Answer: C) ) Connect(host=”host name”, user=”user name”, passwd=”password”, database=


“database name”)
Q.2 How do you disconnect from a MySQL database in Python?
a) connection.close()
b) cursor.close()
c) db.close()
d) mysql.close()
Answer: a) connection.close()
Q.3 What type of object is returned by mysql.connector.connect()?
a) Connection object
b) Cursor object
c) Database object
d) ResultSet object
Answer: a) Connection object
Q.4 Which of the following is the correct way to install mysql-connector-python using pip?
a) pip install mysql-connector-python
b) pip install MySQLConnectorPython
c) pip install mysql-connector
d) pip install python-mysql-connector
Answer: a) pip install mysql-connector-python
Q.5 Which of the following methods is used to fetch the next row of a query result?
a) next()
b) fetchnext()
c) fetchone()
d) fetchrow()
Answer: c) fetchone()
Q.6 In mysql.connector.connect(user='root', password='password'), what are 'user' and
'password'?
a) Connection settings
b) SQL commands
c) Data to be inserted
d) Database functions
Answer: a) Connection settings
Q.7 Which method is used to close the database connection in Python?
a) connection.close()
b) db.close()
c) mysql.close()
d) cursor.close()
Answer: a) connection.close()
Q.8 What is the purpose of the commit() method in MySQL Python interface?
pg. 79
a) To save changes to the database
b) To execute a query
c) To fetch results from the database
d) To close the connection
Answer: a) To save changes to the database
Q.9 What will cursor.execute("INSERT INTO students (name, age) VALUES (%s, %s)", ("John",
20)) do?
a) Insert a new row into the students table
b) Update a row in the students table
c) Delete a row from the students table
d) Select a row from the students table
Answer: a) Insert a new row into the students table
Q.10 What does the cursor.rowcount attribute represent?
a) The number of columns in the result set
b) The number of rows affected by the last operation
c) The number of tables in the database
d) The number of databases on the server
Answer: b) The number of rows affected by the last operation

Topic: Case Study Based Questions on SQL joins

Case Study 1: Students and Courses


Question 1: You have two tables: Students and Courses. You need to list all students along
with the courses they are enrolled in. Each student has a CourseID in the Students table that
matches the CourseID in the Courses table.
Answer :- SELECT Students.StudentName, Courses.CourseName
FROM Students, Courses WHERE Students.CourseID = Courses.CourseID;

Case Study 2: Employees and Departments


Question 2: You have two tables: Employees and Departments. You need to list all
employees along with their department names. The DepartmentID in the Employees table
matches the DepartmentID in the Departments table.

Answer :- SELECT Employees.EmployeeName, Departments.DepartmentName


FROM Employees
JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;
Or
SELECT Employees.EmployeeName, Departments.DepartmentName
FROM Employees, Departments WHERE Employees.DepartmentID =
Departments.DepartmentID;

Case Study 3: Movies and Directors


Question 3: You have two tables: Movies and Directors. You need to list all movies along
with the names of their directors. The DirectorID in the Movies table matches the DirectorID
in the Directors table.
Answer:- SELECT Movies.MovieTitle, Directors.DirectorName
FROM Movies, Directors WHERE Movies.DirectorID = Directors.DirectorID;
pg. 80
Case Study 4 : Consider three tables in a database: employees, departments, and projects.
Each table contains information as follows:
The employees table includes columns for employee_id, employee_name, and
department_id.
The departments table includes columns for department_id and department_name.
The projects table includes columns for project_id, project_name, and department_id.
a) Write an SQL query to perform a Cartesian product between the employees and projects
tables, displaying all possible combinations of employees and projects.
b) Write an SQL query to retrieve the names of employees along with the names of their
corresponding departments using an equijoin between the employees and departments
tables.
c) Write an SQL query to retrieve the names of projects along with the names of their
corresponding departments using a natural join between the projects and departments
tables.

Answer a) SELECT employees.employee_id, employees.employee_name,


projects.project_id, projects.project_name FROM employees CROSS JOIN projects;
b) SELECT employees.employee_name, departments.department_name
FROM employees ,departments WHERE employees.department_id =
departments.department_id;
c) SELECT projects.project_name, departments.department_name
FROM projects NATURAL JOIN departments;

Case Study 5: Consider the Following tables and write sql query .
Table Customers
CustomerID CustomerName ContactName Country
1 Alfreds Maria Germany
2 Ana Anil Mexico
3 Antonio Antonio Moreno Mexico
4 Rajsons Thomas UK
5 Benzeer Christina Sweden
Table : Orders
OrderID CustomerID OrderDate
10308 2 2024-03-01
10309 37 2024-03-03
10310 77 2024-03-04
10311 3 2024-03-05
10312 5 2024-03-06

a) Write an SQL query to find the orders along with the customer names for only those
orders that have matching customer records.
b) Write an SQL query to find all customers and their orders, including customers who do
not have any orders.
c) Write an SQL query to find all orders and their customer details, including orders that do
not have a matching customer.
d) Write an SQL query to find all customers and all orders, matching them when possible.
pg. 81
Answer a) SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders ,Customers WHERE Orders.CustomerID = Customers.CustomerID;
b) SELECT Customers.CustomerName, Orders.OrderID, Orders.OrderDate
FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
c) SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders RIGHT JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
d) SELECT Customers.CustomerName, Orders.OrderID, Orders.OrderDate
FROM Customers FULL OUTER JOIN Orders ON Customers.CustomerID =
Orders.CustomerID;

Case Study 6:- Let's say we have a database for a small online bookstore having following
tables
books: ( book_id, title, author_id, genre_id, price).
authors: (author_id, author_name, birth_year)
genres: (genre_id , genre_name).
customers: (customer_id, customer_name, email)
orders: (order_id, customer_id, order_date, total_amount)
order_details: (order_id, book_id, quantity, unit_price).
a) List all books along with their corresponding authors.
b) Display the total number of orders placed by each customer.
c) List all authors who have written books in the 'Science Fiction' genre.
d) Find the total revenue generated from each genre

Answer
a) SELECT books.title, authors.author_name, genres.genre_name
FROM books ,authors WHERE books.author_id = authors.author_id ;
b) SELECT customers.customer_name, COUNT(orders.order_id) AS total_orders
FROM customers
LEFT JOIN orders ON customers.customer_id = orders.customer_id
GROUP BY customers.customer_name;
c) SELECT DISTINCT authors.author_name
FROM authors
JOIN books ON authors.author_id = books.author_id
JOIN genres ON books.genre_id = genres.genre_id
WHERE genres.genre_name = 'Science Fiction';
d) SELECT genres.genre_name, SUM(order_details.quantity * order_details.unit_price) AS
total_revenue FROM genres
JOIN books ON genres.genre_id = books.genre_id
JOIN order_details ON books.book_id = order_details.book_id
GROUP BY genres.genre_name;
Case Study 7: Bank Database
Consider a bank named "SafeBank" that manages accounts, customers, and transactions.
The bank maintains data about accounts, customers, transactions, and branches in its
database.
Here are the tables in the SecureBank database:
1. accounts: Contains information about bank accounts, including account_number,
customer_id, balance, and branch_id.
pg. 82
2. customers: Stores details about bank customers, such as customer_id, customer_name,
email, and phone_number.
3. transactions: Contains information about transactions, including transaction_id,
account_number, transaction_type, amount, and transaction_date.
4. branches: Stores details about bank branches, including branch_id, branch_name, location,
and manager.
a) List all accounts along with the names of their account holders and their current balances.
b) Find the total balance of all accounts in each branch.
c) Display the names of branches along with the names of their managers.
d) Find the average balance of accounts for each customer.
Answer
a) SELECT a.account_number, c.customer_name, a.balance
FROM accounts a , customers c WHERE a.customer_id = c.customer_id;

b) SELECT b.branch_id, b.branch_name, SUM(a.balance) AS total_balance


FROM branches b, accounts a WHERE b.branch_id = a.branch_id
GROUP BY b.branch_id, b.branch_name;

c) SELECT b.branch_name, m.manager_name


FROM branches b ,managers m WHERE b.manager_id = m.manager_id;
d) SELECT c.customer_id, c.customer_name, AVG(a.balance) AS avg_balance
FROM customers c, accounts a WHERE c.customer_id = a.customer_id
GROUP BY c.customer_id, c.customer_name;

Case Study 8 : Student and Teacher


Let's consider two tables, "students" and "teachers", and generate SQL join queries based
on them.
Table Structures:
students: Contains information about students. Columns( student_id, student_name,
class_id, age)
teachers: Stores details about teachers. Columns: (teacher_id, teacher_name,
subject_taught)
a) List all students along with their corresponding class names.
b) Display the names of teachers along with the subjects they teach.
c) Show the names of students who are enrolled in the 'Mathematics' class.
d) List all subjects along with the names of classes they are taught in.
e) Find the total number of students in each class.
Answer
a) SELECT s.student_id, s.student_name, c.class_name
FROM students s ,classes c WHERE s.class_id = c.class_id;
b) SELECT t.teacher_id, t.teacher_name, t.subject_taught FROM teachers t;
c) SELECT s.student_name FROM students s, classes c WHERE s.class_id = c.class_id
and c.class_name = 'Mathematics';
d) SELECT c.class_name, t.subject_taught
FROM classes c ,teachers t WHERE c.class_id = t.class_id;
e) SELECT c.class_name, COUNT(s.student_id) AS total_students
FROM classes c , students s WHERE c.class_id = s.class_id
GROUP BY c.class_name;

pg. 83
Case Study 9 Let's consider two tables, "doctors" and "patients", and generate SQL join
queries based on them.
Table Structures:
doctors: Contains information about doctors. Columns( doctor_id, doctor_name,
specialization, hospital_id)
patients: Stores details about patients. Columns: (patient_id, patient_name, doctor_id,
admission_date)
a) List all patients along with the names of their treating doctors.
b) Show the names of patients who are treated by doctors specializing in 'Cardiology'.
c) List all doctors along with the number of patients they are treating.
d) Find the total number of patients treated in each hospital.
e) Display the names of patients along with their admission dates and the names of their
treating doctors.
Answer
a) SELECT p.patient_id, p.patient_name, d.doctor_name
FROM patients p, doctors d WHERE p.doctor_id = d.doctor_id;
b) SELECT p.patient_name
FROM patients p, doctors d WHERE p.doctor_id = d.doctor_id and d.specialization =
'Cardiology';
c) SELECT d.doctor_name, COUNT(p.patient_id) AS num_patients
FROM doctors d LEFT JOIN patients p ON d.doctor_id = p.doctor_id
GROUP BY d.doctor_name;
d) SELECT d.hospital_id, COUNT(p.patient_id) AS num_patients
FROM doctors d ,patients p WHERE d.doctor_id = p.doctor_id
GROUP BY d.hospital_id;
e) SELECT p.patient_name, p.admission_date, d.doctor_name
FROM patients p, doctors d WHERE p.doctor_id = d.doctor_id;
Case Study 10 :- let's consider two tables, "railway" and "passenger", and generate SQL join
queries based on them.
Table Structures:
railway: Contains information about railway trips. Columns: (trip_id, source_station,
destination_station, departure_time, arrival_time)
passenger: Stores details about passengers on railway trips.Columns( passenger_id, trip_id,
passenger_name, ticket_number, seat_number)
1) List all passengers along with the details of their corresponding railway trips.
2) Display the source and destination stations for all railway trips along with the names of
passengers on each trip.
3) Show the names of passengers who traveled between 'Station A' and 'Station B'.
4) List all railway trips along with the total number of passengers on each trip.
5) Find the total number of passengers who traveled from each source station.
Answer
1) SELECT p.passenger_id, p.passenger_name, r.source_station, r.destination_station,
r.departure_time, r.arrival_time FROM passenger p, railway r WHERE p.trip_id = r.trip_id;
2) SELECT r.trip_id, r.source_station, r.destination_station, p.passenger_name
FROM railway r , passenger p WHERE r.trip_id = p.trip_id;
3) SELECT p.passenger_name
FROM passenger p, railway r WHERE p.trip_id = r.trip_id
And r.source_station = 'Station A' AND r.destination_station = 'Station B';
4) SELECT r.trip_id, COUNT(p.passenger_id) AS num_passengers
FROM railway r, passenger p WHERE r.trip_id = p.trip_id

pg. 84
GROUP BY r.trip_id;
5) SELECT r.source_station, COUNT(p.passenger_id) AS num_passengers
FROM railway r, passenger p WHERE r.trip_id = p.trip_id
GROUP BY r.source_station;

Topic : SQL Joins ASSERTION and REASONING based questions.


Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is False but R is True
Q1. Assertion(A): Inner join returns only the matching rows from both tables.
Reason (R ): Inner join combines rows from two or more tables based on a related
column between them.

Q2. Assertion( A) : Full outer join can result in null values in the output.
Reason (R) : Full outer join returns all rows when there is a match in one of the tables.

Q3. Assertion (A) : Cross join results in a Cartesian product.


Reason (R): Cross join is used when you want to combine each row of the first table with
each row of the second table.

Q4. Assertion (A): A left join can return more rows than the original left table.
Reason (R): Left join returns all rows from the left table, and the matched rows from the
right table.

Q5. Assertion( A) : Using a right join on tables with no matching keys will result in an empty
result set.
Reason( R) : Right join returns all rows from the right table and the matched rows from the
left table.

Q6. Assertion( A) : A self join is used to join a table with itself.


Reason ( R) : Self join is useful for comparing rows within the same table.

Q7 Assertion( A) : Natural join can lead to ambiguous column names in the result.
Reason ( R) : Natural join automatically joins tables using columns with the same names.

Q8 Assertion ( A) : Using aliases in joins can improve the readability of the SQL query.
Reason( R) : Aliases provide a shorthand for table names and can simplify the query syntax.

Q9. Assertion (A): Equijoin returns rows where there is an exact match between the
specified columns of the joined tables.
Reason ( R ): Equijoin uses the equality operator (=) to compare columns from the tables
being joined.

Q10. Assertion ( A) : Equijoin can result in duplicated column names in the output.
pg. 85
Reason (R): Equijoin does not automatically remove duplicate columns and includes all
columns from the joined tables.

Answer
Question Answer
1 (a)
2 (a)
3 (a)
4 (d)
5 (d)
6 (a)
7 (c )
8 (a)
9 (a)
10 (a)

pg. 86

You might also like