0 ratings0% found this document useful (0 votes) 117 views23 pagesXII Python Viva Voice Questions
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Viva Voce Questions
How is Python translated to its object code ?
Ans. Python language is an interpreted language. That is, the code executes line by
line. Python converts the source code line by line into an intermediate language and
then into machine language which is then executed. So, if error occurs in one line of the
code, first one needs to correct it before resuming the conversion and execution of
following lines of the code.
Which built-in types does Python provide ?
Ans. Python’s built in types are : Numbers (integers, Booleans, floating point numbers
and complex numbers), Strings, Lists, Sets, Tuples, Dictionaries.
Name mutable and immutable built-in data types of Python.
Ans. Python's Mutable built-in types are :
Lists, Sets, Dictionaries.
Python's Immutable built-in types are :
Strings, Tuples, Numbers.
What is case sensitivity 2 Is Python case-sensitive ?
Ans. A language is case-sensitive if it treats uppercase letters and lowercase letters
differently. That means identifiers like name, Name and NAME are different in a case
sensitive language.
Python is a case sensitive language.
What is pass statement of Python ?
Ans. Pass is a no-operation Python statement. It is written where the syntax
demands a statement but logic demands no-action.
What is the difference between list and tuple ?
Ans. Lists and tuples, both are sequence of elements but the difference between
them is that lists are mutable types while tuples are not.
What is slicing in Pijthon ?
‘Ans, It is the selecting of a sub-sequence or a sequence of elements contained in
sequences like list, tuple, strings etc.
What is tie pliRpORe of Comments nll Incenitation tna prégrant’?
Ans.
Comments let one insert programmer related information.
Indentation makes the program readable and presentable,
oe322 MOVE FAST WITH COMPUT
SCIENCE (Python) = Xt
9. What is docstring in Python ?
Ans. A docstring is a Python documentation string. Docstrings are used te
documenting Python functions, modules and classes. Docstrings are written «
triple-quoted strings. Docstrings written in program code are ignored by the Python
interpreter.
10. What is the purpose of docstrings in Python ?
Ans. In Python, the docstring is a triple quoted string used for documentation
Purpose, written in program code ~ in Python functions, modules, classes. Details
given in docstrings are listed through help( )
11. Ina program, both docstrings and comments are not processed by the Python interpreter, ther
do docstrings and comments mean the same thing? If not, how are docstrings different frm
comments ?
‘Ans. Both docstrings and comments are ignored by the interpreter, ie., these aw
not considered for execution purpose. In that sense both comments and docstrings aw
the same,
BUT docstrings are not just comments. The information given in docstrings is
treated as documentation for the program/module, which we can access using the
help( ) function.
12, What is the usage of help( ) and dir( ) function in Python?
Ans. Both the functions help() and dir( ), are accessible from the Python interpreter
and are used for viewing a consolidated dump of built-in functions.
> The help() function is used to display the documentation text and also facilitates
us to see the help related to modules, keywords, and attributes.
> The dir() function is used to display the defined symbols.
13. What is negative index in Python ?
Ans. Python sequences can have indexes of both types : positive and negative. While
positive indexes begin from 0 for the first element and go till size-1 for the last element
the negative index is a backward indexing where ~1 is for the last element and it moves
backwards with -size index for the first element.
listt =['2', 0°, 7, 0, vi]
Forwardindexing > 0 1 2 3 4
isi! ae | 0 wu 7
-5 -4 -9 -2 -1 Backward indexing] *
List Elements’ two way indexing Lst = [47, True, “good”, 4.59)
14, What does [:: -1} do?
Ans. [:: -1] is used to reverse the order of an array or a sequence.
For example :
>>> List =[1, 2, ,3,4, 5]
>>> List(:#-1)
(5,4, 3,2, 2])[2-1] reprints a reversed copy of ordered data structures stich as an array or a lint
‘The original array or list remains unchanged
15, What will be the output of datal-2) from the fist data = (2, 4, 6, 8, 9, 3, 0)?
Ans. Ina list, the -2™! (negative 2 index) index, In 2 index from the right. The
clement present at this index is 3 In given list, So, the output will be %
16 Can you convert a string into an int in Python ?
Ans. If a string contains only numerical characters, we can convert it into an integer
using, the int() function, however, we cannot convert alphabetic and alphanumeric
strings to integer in Python.
17, How do you convert a number to a string ?
Ans. To convert a number into a string, we can use the inbuilt function str( ). For
octal or hexadecimal representation, we can use the inbuilt function oct( ) or hex(
18, What is the use of // operator in Python ?
Ans. The // operator is a floor division operator. It gives the integer quotient
resulting, from the division of two numbers while discarding, the remainder or
fractional part
19. How do you check whether the fwvo variables are pointing to the same object in Python ?
Ans. In Python, we have an operator called ‘is’, which returns true if the two
variables are pointing, to the same object. For example,
>>> a= "Computer"
>>>
>r>raisc
True
We can confirm this by checking the id’s (memory address) of both these objects.
For is to return True, both objects must be pointing to same memory address
>>> id(a)
47173368
>>> id(c)
47173368
20. What is the difference between deep and shallow copy ?
Ans. Shallow copy just creates a new label for a sequence or object. It does not
create separate memory holding duplicate copy of elements.
object/sequence are reflected in shallow copy.
Changes made in original
Deep copy creates a separate memory area and then creates labels for each element
there. Thus deep copy is also called the true copy. Changes made in original
object/sequence are not reflected in deep copy
21, What is the purpose of “end” argument in print) in’ Python?
‘Ans, By default the print( ) function always prints a newline in the end, ic, the
following output will appear on the next line (default behaviour). To suppress this
default behaviour, the print( ) function accepts an optional parameter known as the
‘end.’ Its value is ’\n’ by default. We can change the end character in a print statement
with the value of our choice using this parameter.324 MOM FAST Wits COMPUTES CENCE Byron
So Hf we change the end’s value as space then space will be printed at the end
Pant ) > output and next output wall continue in the same line
For creampie
Print (my?
print( “worle”)
will eve output as
y
world
While the code
print(“my”, end =")
print (“world”)
will give output as
My world
22 What is for-else and while-clse in Python ?
Ans. Python provides an interesting way of handling loops by providing a provisos
to write else block in case the loop is not satisfying the condition. So, else clause of a loop
can be thought of as the false-part of the while loop i.e, it gets executed when the while
loop’s condition is false. For the for loop, it executes when for loop ends normally
23 How do you programmatically know the version of Python you are using ?
Ans. The version property under sys module will give the version of Python thet
we are using,
>>> import sys
>>> sys.version
24. What is the role of len( ) function in Python ?
‘Ans. The len( ) determines the length of an a sequence, eg., for a string “My
world”, the len( ) would yield the result as 8
>>> string = "My world”
>>> len(string)
8
25. What is the role of chr() function in Python?
‘Ans. The chr( ) returns the string storing a character whose Unicode value is passed
to it in integer form. For example, the chr(97) will return the string ‘a’.
>>> chr(98)
el
What is the role of ond( ) function in Python ?
‘Ans. The ord( ) returns the Unicode value in integer form corresponding to a sting
storing a character. For example, the ord(’a’) will return the integer value 97.
>>> ord(“b*)
98
ga
VIVA VOCE QUESTIONS 325
27. What isa tuple in Python ?
Ans. A tuple is a sequence or a collection type data structure in Python which is
immutable. The elements of tuples are enclosed in parentheses, ¢.8.,
T1= (3,5, 7,9)
The tuples are immutable, i.e., their elements cannot be changed in place.
28. What is a dictionary in Python ?
Ans. A dictionary is a data structure known as an associative array in Python
which stores a collection of objects in the form of key:value pairs. The collection is a set
of keys having a single associated value.
A Dictionary is also known as a hash, a map, or a hashmap in other programming
languages.
29. How will you remove the last object from a list ?
Ans. Using the index -1, we can access the last element of a list. Thus, in a list
namely mylist, following code
List. pop(obj = mylist({-1])
will remove and return last element from the list.
30. Differentiate between append( ) and extend( ) methods.
‘Ans. Both append{ ) and extend( ) methods are the methods of lists. Both these
methods add the elements at the end of the list. But append( ) adds single element,
while extend( ) can add a list of elements, i,
append(element)
~ adds the given element at the end of the list which has called this method.
extend(another-1ist)
- adds the elements of another-List at the end of the list which is
called the extend method.
31. What is Index Out of Range error ?
‘Ans. When the value passed to the index operator is greater than the actual size of
the tuple or list, Index Out of Range error is thrown by Python.
>>>a=[11,21,31,41]#ais alist
>>> a[3]
41
>>> al 4]
Traceback (most recent call last):
IndexError: list index out of range
>>>b=(1,3,5) #bisatuple
>>> b[4]
Traceback (most recent call last):
IndexError: tuple index out of range35.
37.
39.
41.
MOVE FAST WITH COMPUTER SCIENCE (Python) ~ Xi
Consider the given Python code fragment : A = 15, 20, 25
In the above assignment operation, what is the data type of ‘A’ ?
Ans. The data type of A is tuple, because when we assign a group of comma
separated values to a single name, Python creates a tuple out of it. This type of
assignment is called “Tuple Packing”.
Consider the below given Python code fragment.
>>> A= 101, 202, 303, 404
>>>a, b,c, d=A
What is the value assigned to the variable d?
Ans. 404
Why is following code giving error (TypeError)? What could be the reason ?
>>> a,b,c, d=R
Ans. For the given statement to work, R must be a sequence or iterable with 4
variables in it, otherwise (eg,, if R is an integer or a float value) the above statement
will produce error.
The previous question's assigning tuple elements to individual variables ~ what is this type of
assignment called ?
Ans. This type of assignment is called ‘Tuple Unpacking’
What is the use of the dictionary in Python ?
Ans. A dictionary is an associative array (also known as hashes). Any key of the
dictionary is associated (or mapped) to a value. Thus, to store values that come in paits
and are associated with one another, dictionaries are used.
How do you add elements to a dictionary in Python ?
‘Ans. We can add elements by modifying the dictionary with a fresh key and then
set the value to it
How do you get all keys from a Python dictionary ?
Ans. To get all keys from a dictionary, we can use keys( ) method with the
dictionary name.
How do you get all values from a Python dictionary ?
Ans. To get all values from a dictionary, we can use values( ) method with the
dictionary name.
How do you delete elements of a dictionary in Python?
Ans. There are two ways of doing this :
(i) by using the del ) method.
(ii) by use is the pop( ) function.
‘How do you check the presence of a key in a dictionary ?
‘Ans. We can use Python's “in” operator to test the presence of a key inside @
dictionary object. :VIVA VOCE QUESTIONS 327
42, Differentiate between a run-time error and syntax error. Give one example of each.
Ans. A run-time error is that occurs during execution of a program. The compilation
of the program is not affected with it. For example, ‘File could not be opened’ ‘Not enough
memory available’ are ran time errors.
A Syntax error is that when statements are wrongly written violating rules of the
programming language. For example MAX + 2 = DMAX is a syntax error as an
expression can not appear on the left side of an assignment operator.
43. Name some standard Python errors that may occur.
Ans.
TypeError Occurs when the expected type doesn’t match with the given type
of a variable
Valuetrror When an expected value is not given- if you are expecting 4
elements in a list and you gave 2.
NameError Occurs when trying to access a variable or a function that is not
defined.
Indexérror Accessing an invalid index of a sequence will throw an IndexError.
KeyError When an invalid key is used to access a value in the dictionary.
44. Is it mandatory for a Python function to return a value ?
Ans. It is not at all necessary for a function to return any value.
45. The void functions are non-returning functions, i.e. they do not return a value to their caller.
How does a void function intimate its caller that is returning no value?
‘Ans. The void functions return a legal empty/missing-value object, None, to their
caller to signify it.
46. What are different ways of argument matching in Python functions?
Ans. In python functions, the arguments can be matched in these ways
= Positional matching. It is normal way of matching arguments wherein
arguments are matched left to right, iv, arguments are matched by their
position or order of placement.
Keyword/named argument matching. In this way of argument matching,
arguments are matched by the argument name, irrespective of their position in
function call statement.
Default argument matching. This type of argument matching takes place only
if the function call passes fewer values that the required parameters. In such a
case, the missing arguments get the default values already defined in function
definition.
Vv
v
47. Consider the following code lines. Find out, where these code lines appear in a code (ie., when
inside caller function of inside the function definition) and identify the type of argument and
matching style in these.
func(value, 60)
func(a = 25, name = value)
def func(name, a =12)
func(a = 25, value)328
49.
51.
52.
MOVE FAST WITH COMPUTER SCIENCE (Python) - i
Ee ay
ii
Calter — | Normal argument : positional matching, for by,
Calter | Keyword arguments : both arguments are matched by
4 ames Seems
Function | Normal argument : name will be matched any by
positional or named argument.
Paramcter a, if given in function call, will be matche)
any by positional or named argument, but if sipped
default arg hing will be pe
Caller | 11 will cause error as positional arguments must rp
follow keyword arguments.
. What is the name of top level segment in a program, ive., the segment which is not part ofan
function?
Ans. Python names the top level segment as _main__
In a program, if there are five different functions defined, wherefrom Python will stun
executing ?
Ans. Python always starts the execution of a program from the top level segment
named as _main__, irrespective of number of functions defined in the program,
. If a function is defined in a program, but not called through _main__ section, willit everle
invoked ?
Ans. A function defined but not invoked (directly or indifectly) from _main_
will never be executed.
In order for a function to be called, it must be called either directly or indirectly
(when its caller is called through __main__and then its caller calls it) from __main_
segment.
Can a function have multiple return statements in it ?
Ans. Yes, a function can have multiple return statements in it
Can a Python function return multiple values?
Ans. Yes, a Python function can return multiple values by giving comma separate
values in the return statement, ¢.¢.,
returna, b, c,d
What are fruitful and won-fruitfill questions ?
‘Ans. The functions returning some legal values are called fruitful functions and
void functions, the functions not returning any legal value are called non-fruiltu!
functions.
Whial is a variable's scope ?
‘Ans. The scope of a variable refers to the context in which that variable is
visible/accessible to the Python interpreter.A YOCE QUESTIONS 329
35, What is local scope and global scope in Python ?
Ans. A variable defined inside a function is locally available to the function and
hence it has local scope. A variable defined outside all functions is globally available
across all parts of a program and it has global scope.
56. In which order does Python resolve a nae when accessed ?
Ans. Python resolves a name being accessed as per LEGB order
(i) It first looks for the name in local environment,
(ii) If not found in local scope, then it looks for the name in its enclosing
environment,
(iti) If not found in enclosing scope, then it looks for the name in its global
environment,
(iv) If not found in global scope, then it looks for the name in its built-in
environment,
57. What are modules in Python ?
Ans. The Python Modules refer to a file containing Python statements and function
definitions. A file containing Python code, for e.g., abe.py, is called a module and its
module name would be abe.
We use modules to break down iarge programs into small manageable and
organized files. Furthermore, modules provide reusability of code.
58. How do you import modules in Python?
Ans. We can import the definitions inside a module to another module by using
the import command.
To import a module namely abc, we can type the following =
>>> import abe
59. What's the difference between “import module” and “from moduile import *” statements?
Ans. The import statement, ¢.g.,
import sys
creates a new namespace by the name “sys” into your module and to access each of the
function/definition defined in it, you need to use qualified name as sys..
It does not give you direct access to any of the names inside sys module . To access
those you need to prefix them with sys, e.g., sys.exit( ).
‘The from module import statement, ¢.g.,
from sys import *
does not creates a new namespace “sys” into your module, rather it brings all of
the names/functions/definitions given inside sys into your module's existing
namespace.
Now you can access those names without a prefix, like this :
exit()330
60.
61.
62.
63,
MOVE FAST WITH COMPUIER SCIENCE [PyAhon) _¥t
What are the possible consequences of using from import command ?
Ans. As from module import command adds all the names/definitions in the
current namespace, any similar name will simply get overwritten
What are Python packages ?
Ans. Python packages are namespaces containing multiple modules.
Which file must added to directory structure of your module files in order to make it ay
importable package ?
Ans. __init__.py
What is the difference between “r” and “r+” file modes ?
Ans. The “r” mode opens a file for reading only. The file pointer is placed at the
beginning of the file. This is the default mode.
The “r+” mode opens a file for both reading and writing. The file pointer placed at
the beginning of the file
What is the difference between “w” and “w+” file modes?
Ans. The “w” mode opens a file for writing only. It overwrites the file if the file
exists. If the file does not exist, creates a new file for writing.
The “w+” mode opens a file for both writing and reading. It overwrites the
existing file if the file exists. If the file does not exist, creates a new file for writing and
reading.
What is the difference between “a” and “at” file modes ?
Ans. The “a” mode opens a file for appending. The file pointer is at the end of the
file if the file exists. That is, the file is in the append mode. If the file does not exist, it
creates a new file for writing,
The “at” mode opens a file for both appending and reading. The file pointer is at the
end of the file if the file exists. The file opens in the append mode. If the file does not
exist, it creates a new file for reading and writing,
What are common file processing modes supported by Python ?
Ans. Python provides three modes to open files. The read-only, write-only,
read-write and append mode. ’r is used to open a file in read-only mode, ‘w’ is used to
open a file in write-only mode, ‘rw’ is used to open in reading and write mode, 'a’is
used to opena file in append mode. If the mode is not specified, by default file opens in
read-only mode.
‘Opens a file for reading. It is the default mode.
Opens a file for writing, If the file contains data, data would be
lost, Otherwise a new file is created.
Opens a file for reading, write mode. It means updating mode.
‘Opens for writing, append to the end of the file, if the file exists.67.
m4,
VIVA VOCE QUESTIONS 331
Ifa text file contains only one line and the file is read using readline( ) function in one program
and using readlines() in another program? What would be the difference in two programs?
(a) a= open(“sample.txt”) .readline()
print(type(a))
(0) a= open("sample. txt"). readlines()
print (type(a))
Ans. The readline() will read the line of text from file and return the result in form
of a string while readlines( ) will read the line of text from the file and return the result
in the form of a list.
If data to be written in a file is available in the form of alist, which function would you use to
write it into a file?
Ans.
writelines()
If data to be written in a file is available in the form of a string, which function would you use
to write it into a file?
Ans.
write()
Which command will you use to read “n” number of characters from a file using the file object
?
Ans.
read(n)
Which command will you use to read the entire contents of a file asa string using the file
abject ?
Ans.
.read()
Which command will you use to read the next line of a file using the file object ?
Ans.
.readline()
Which command will you use to read the remaining lines of afile using the file object ?
Ans.
.readlines()
Which of the following are\the file modes of both twriting and reading in Python files ?
(a) wb+ @)w - () wb (d) w+
‘Ans, wb+ and w+ modes
“we” opens a text file for both writing and reading. It overwrites the existing file if
the file exists. If the file does not exist, it creates a new file for reading and writing
“wb+” opens a file for both writing and reading in binary format, overwrites the
existing file if the file exists. IF the file does not exist, it creates a new file for reading and
writing.332
75,
70.
7.
78.
79.
80.
81.
82.
MOVE FAST WIIH COMPUIER SCIENCE (Pylon) Xt
What is the difference between rand w+ modes ?
Ans. In mode r+, the fil
mode we, the pointer is at th
pointer is initially placed at the be
nd of the file, when opened.
ning, of the file and in
What are two forms of text files ?
Ans. The text files are of following, types :
() Regular Text files. These are the text files which store the text in the same form
as typed, Here the newline character ends a line and the text translations take
place.
(ii) Delinuted Text files. In these text files, a specific character is stored to separate
the values, éc,, after each value, c.g. a tab or a comma after every value,
What is pickling ?
Ans. IL is the process of converting, Python object hierarchy into a byte stream so
that it can be written into a binary file,
What is unpickling ?
Ans, Unpickling is the inverse of Pickling where a byte stream stored in a binary
(pickled) file, is converted into an object hierarchy. Unpickling produces the exact
replica of the original object
Which pickle module function allows you to perform the pickling process ?
Ans. pickle.dump( ) function
Which pickle module function allows you to perform the unpickling process ?
Ans. pickle.load( ) function
What are csv files ?
Ans. A CSV file (Comma Separated Values) is a type of plain text file that holds
tabular data. As the name suggests, CSVs generally use commas to separate each data
value, but other than comma, it supports other separators too,
Are ¢sv files the text files ?
Ans. Yes, All CSV files are plain text files wherein different data items stored witha
separator/delimiter character embedded in between,
What.are delimiters in the context of esv files ?
‘Ans. In csv files, the character or symbol used to separate the data items is called
delimiter, which is mostly a comma. However, Commas aren't the only way to
separate data ; other delimiters could be a tab (\Q), colon ( : ), or semi-colon ( ; ).
What are tsv files? Are they type of sv files ?
Ans. When a tab character is used to separate the values stored, these are called
TSV files (Tab Separated Values files).
Yes, TSV files are a type of CSV files where the delimiter used is the tab character.
Whidh built-in library does Pyllion provide to tse aid work with csv files ?
Ans. The csv module/library.87.
a1
Dy
VIVA VOCE QUESTIONS 333
What is recursion ?
Ans. In a program, if a function calls itself (whether directly or indirectly), it is
known as recursion. And the function calling itself is called recursive function .
following, are two examples of recursion :
(i) def aC): (i) def BC):
AC) cc)
def CC) +
8)
What are base case and recursive case? What is their role in a recursive program?
Ans. In a recursive solution, the Base cases are predetermined sotutions for the
simplest versions of the problem : if the given problem is a base case, no further
computation is necessary to get the result.
The recursive case is the one that calls the function again with a new set of values,
The recursive step is a set of rules that eventually reduces all versions of the problem to
one of the base cases when applied repeatedly.
Why is base case so important in a recursive function ?
Ans. The base case, in a recursive case, represents a pre-known case whose solution is
also preknown.
This case is very important because upon reaching at base case, the termination of
recursive function occurs as base case does not invoke the function again, rather it
returns a pre-known result. In the absence of base case, the recursive function executes
endlessly. Therefore, the execution of base case is necessary for the termination of the
recursive function.
When does infinite recursion occur ?
Ans. Infinite recursion is when a recursive function executes itself again and again,
endlessly. This happens when either the base case is missing or it is not reachable.
Compare iteration and recursion.
Ans. In iteration, the code is executed repeatedly using the same memory space.
That is, the memory space allocated once, is used for each pass of the loop.
On the other hand in recursion, since it involves function call at each step, fresh
memory is allocated for each recursive call. For this reason ie., because of function call
overheads, the recursive function runs slower than its iterative counterpart
When would a recursive solution make more sense than iterative solution?
Ans. Recursion is a way of arriving at a solution by breaking down the input into
smaller and smaller pieces until it can no longer be broken down. The final output is
calculated by putting together the output of these calls with the “smaller” inputs
If the input of a question consists of sub-problems where each of the sub-problem
can be solved using the same logic with a different value, then, it’s a good indication
that recursion is needed
Out of iterative and recursive solutions, which one is slowerlfaster and why ?
Ans. Out of the two, the iterative version is faster comparatively. The iterative
version works with same memory every time while recursive version has to call a new
function for every new value. This additional function call overheads make it slower.334
93,
o4
96.
97.
98.
MOVE FAST WH COMPUTER
HENCE (Python) XW
What és an algorithin ?
Ans. An algorithm is any well-defined computational procedure which aims to
find a solution of a given problem, An algorithm takes some values as input ang
produces some result as output. An algorithm is thus a sequence of computational
steps that transtoray the input into the output
What is @ Stack ? :
Ans. Stack is a linear data structure which the order LIFO (Last Int First Out) or
D (First In Last Out) for accessing, elements.
Name some common apptications of stacks ?
A
Common Applications of Stacks
> Intix to Posttix Conversion using Stack
> Evaluation of Postfix Expre
> Reverse a String using Stack
> Implement two s
Jacks in an array
> Check for balanced parentheses in an expression
What is a Queue ?
Ans. Queue is a linear structure which follows the order is First In First Out (FIFO)
to access elements.
Name some common applications of queues ?
Ans.
Common Applications of queue:
> First come first served queues/lines
> Resource sharing, among, multiple consumers
= Using shared printer with multiple computers
a Call center phone system attending, multiple calls waiting/on-hold
> Airports sharing a runway for flights in waiting
> CPU being shared among jobs having similar priority
Describe the similarities and differences betwoeen queues and stacks,
Ans, Similarities
1. Both queues and stacks are special cases of linear |
2. Both can be implemented as arrays or linked lists.
Differences :
A stack is a LIFO list, a queue is a FIFO list.
2. There are no variations of stack, a queue, however, may be circular oF
deque.
Whiat is\a netoork?
Ans. A network is a set of devices that are connected by a physical link or two or
more networks are connected by one or more nodes, Example of a network is the
Internet. The Internet connects the millions of people across the world.335
VIVA VOCE QUESHON:
1, What do you mean by network topology ?
Ans. Network topology specities the layout of a computer network It shows how
devices and cables are connected to each other. Common types of topologies are bus,
star, ring, mesh, graph,
101, What are major types of networks and explain ?
Ans. > Server-based network “> Peer-to-peer network
Server-based networks provide centralized control of network resources and rely on
server computers to provide security and network administration.
Peer-to-peer network, computers can act as both servers sharing resources and as
clients using the resources.
Define the
Ans.
102. following terms : (i) Node (ii) Workstation (iii) Server (ie) NIU (0) TAP
(i) Node. A computer that is attached to a network is known as node.
qi)
(ii)
(iv)
Workstation. A node is also called workstation.
Server. A computer that facilitates resource sharing on a network
NIU. NIU means Network Interface Unit. It is an interpreter that helps
establish communication between the server and the work stations,
(v) TAP. TAP means Terminal Access Point. It is another name tor NIU.
103. What is the difference between Hub, Switch, and Router ?
Ans.
“Switen
Hub
| Hub is the least expensive, least
Jintelligent and least complicated
Jof the three. It broadcasts all data
|to every port which may cause
rious security and reliability
concer.
In a Network, Hub is a common
[connection point for devices
[connected to the network, Hub,
[contains multiple ports and is
lused to connect segments of
LLAN.
Switches work similarly like
Hubs but in a more efficient
manner. It creates connections
dynamically and. prov
information only. to
requesting, port
the
Switch is a device in a network
which forwards packets in a
network,
The router is smartest and most |
conrplicated out of these three. It
comes in all shapes and sizes
Routers are similar like little
computers dedicated! for routing |
network traltic
Routers are located at gateway |
and forwards data packets.
104, What is meant by internetworking ?
‘Ans. Internetworking is the connection of two or more networks
105, What is a Gateway ?
Ans. A gateway is a device that connects di:
106, What do you mean by a backbone network ?
nilar networks.
‘Ans. A backbone network is a network that is used as a backbone to connect
several LANs together to form a WAN.
FDDI (Fiber Distributed Data Interface) is such a network. FDDI is a high
performance fiber optic token ring LAN running at 100 Mbps over distances upto 200
kms with upto 1000 stations connected.ate
wa
a tay BE anal *
we WAN 8 Seu kt ant (hat que WA Dy
CO an AE gafeE HARES TE Retry
X se io an a
Nurs Se ea ae tanaka Worhatation ca
‘ Jed al shay teimnie thes weve
Vea gg tk doe oa ittios valley thenbe Rave Le regent the
. SGC GS ant ALAA a at yang Ett themiaety et [he ebent a
SL acy oe alive sath sl iMte ented
Wn a Bi WC dae ee?
Nm HGH eee teaovnnet fag tty ARGUE Las atitatoes autres Faginn REUNE fot
Se asaya tins Gyan aitnate:paltne AUTO te HAY Beng a the
Wie 0 nic! WR ay aie atomique?
AEC Eke EA AQUIN GHAI GO SONU MIE REET Menmagen by a
YASH EEN ka ARE atalino EAS Anal tee
SE vane Anannnta tian? Qe Want: vostiay tan
Ea a ue vod ant tohiveny
1 GRE Rem Ae RBRNARG @ Aladeen (AME eM NESTE
Awe
VY Mantutatns OE Misttatna
UY Haaginne Mastilationt
Vo Meagetigaidas Mosstaahatane
Vy Net fe ang
Wie Gee Kuper oF eatery ?
Ale Nees try vetely ALAR ates QMNUpALESHY ANNE genseaplttoal apeewat On
diy Shanes ah geeginptiial ps meh cat be ROS LVE tte this categarien
Ne Vsuanty Byte
UY Fe ee Kea UNS TNs an AIHHEE Retwarka canned te
Sarto ate aki i AEE a bake tan,
VAR Gas a be QO VEIN theme ane the netvarka thet bab
Santee Fas Alito TEE Gly
POA Bye Nena HENS Tie at the neta apinad: aver lage
SIaKAa SA AL OOOCHMIATII UE EVEN AMAR HE awn even anctude a
Aane al EAN a gant Oat together
‘atau ay mnetaed enol? ANGST Oe Us Me fn net?
Ave towne cle nnn Ue Ags EY AEA HARAHIOL Fe HMMA a agnal IE ee
Aavvotoy attte aba totoesnennes Ate wamoueNt al aMtyeanAt ARN ARNT yoann Bae Ehaahunnnnetlygt AN
buatianen Eve Qttey uattl atta: Geode! NH ATARALION Oe ant tat alhoyn tearaanans?
AU a stele fayggnionien aE A Tm TH MH RTE (atlas AnH Faggian aye!
‘aves luatatoa tm aint (Ha loess genase EQty bento GORING poh at AEH RANE CoQ HOAREVIVA VOCE QUESTIONS 337
1h. Whi to Web 2:02
Ans. Web 2.0 refers to added features and applications that make the web more
interactive, support easy online-information exchange and interoperability. Some
noticeable features of Web 2.0 are blogs, wikis, video-sharing websites, social
networking, webnites, RSS etc,
115. What is a server ? What is its\yole ?
Ans. A computer that facilitates the sharing of data, software and hardware
jince resource sharing is the key purpose of a
resources on a network, is called serv
network, a server play» this key role,
There can be two types of servers :
> Non dedicated Servers. It is a workstation on a small network that can double up
as a server
> Dedicated Server. On bigger networks, a computer is reserved for the cause of
serving which is called a dedicated server
116. What are protocols ?
Ans. A protocol means the rules that are applicable for a network. Protocol defines
standardized formats for data packets, techniques for detecting and correcting errors
and so on
To understand the concept of a communication protocol, let us assume that A and
B need to talk to one another. They want to exchange their ideas. But it turns out that,
both, A and B are egoists. They start talking again simultaneously, then pause for
breath simultaneously, and then start talking again. Now imagine the confusion
and chaos. To avoid it, they must follow a set of rules while talking. For instance, say
first A must talk, then he/she must give B a chance to put forward his/her ideas, and
son. This command set of rules would be known as communication protocol for A
ond B.
Thus for effective use of a network it must follow a standardized protocol.
There are various protocols that are used in various types of networks. For example,
IBM LAN software, DEC net (Digital's family of communication protocols), TCP/IP
(Transmission Control Protocol/Internet Protocol) etc. TCP/IP is the native protocol of
internet.
112. Why are protocols needed ?
Ans. In networks, communication occurs between the entities in different systems.
‘Two entities cannot just send bit streams to each other and expect to be understood. For
communication, the entities must agree on a protocol. A protocol is a set of rules that
govern data communication.
118, Whit is ISO OST Standard for Wetivorks)?
Ans. The OSI model was developed to standardize the procedures for exchange of
information between communicating systems. The OSI is a communication reference
model that has been defined by the International Standard Organisation (ISO). The ISO
OSI model is a seven layer communication protocol intended to be a standard for
communication systems world wide.338
119,
120.
121.
122.
123.
124,
125.
MOVE FAST WIIH COMPUTER SCIENCE (Python) ~ Xi
What are the different switching techniques employed to provide communication beticeen
computers ?
Ans. The different switching techniques employed to provide communication
between computers are :
(a) Circuit Switching. When a computer places a telephone call, the switching
equipment within the telephone system seeks out a physical copper path al
the way from sender telephone to the receiver's telephone. In general, an
important property of its is to setup an end-to-end path before any data can
be sent.
(0) Message Switching. In this form of switching no physical copper path is
established in advance between sender and receiver. Instead when the
sender has a block of data to be sent, it is stored in first switching office, then
forwarded later, one jump at a time.
(©) Packet Switching. With message switching, there is no limit on block size, in
contrast packet switching places a tight upper limit on block size.
What is World Wide Web and what are its advantages ?
Ans. The World Wide Web (WWW) isa set of protocols that allows you to access
any document on the NET through a naming system based on URLS (URL means
Uniform Resource Locator, which is a pointer to information on the WWW. It can
include pointers to other types of resources such as ftp servers and gopher server in
addition to WWW servers) WWW also specifies a way the HyperText Transfer
Protocol (HTTP) to request and send a document over the internet. With these
standard protocols of WWW is place, one can set up a server and construct hypertext
documents with links in them that point to the document on the server.
What are cookies ?
Ans. Cookies are messages that a web server transmits to a web browser so that the
web server can keep track of users activity on a specific web site.
What is VoIP ?
Ans, VoIP (Voice over IP) refers to a way to carry telephone calls over an IP data
network. It offers a set of facilities to manage the delivery of voice information over
Internet in digital form.
What is Intellectual Property ?
Ans. The Intellectual Property may be defined as a product of the intellect that has
commercial value, including copyrighted property such as literary or artistic works,
and ideational property.
What is Spam ?
‘Ans. Spam refers to electronic junk mail or junk newsgroups postings. Some
people define spam even more generally as any unsolicited e-mail.
What is attenuation ?
Ans. The degeneration of a signal over distance on a network cable is called
attenuation.MWA VOCL GUSTONS = 339.
126. What is MAC address ?
Ans. The address for a device as it is identified at the Media Access Control (MAC)
layer in the network architecture. MAC address is usually stored in ROM on the
network adapter card and is unique.
127. What is the difference between bit rate aid "bail vate.
Ans. Bit rate is the number of bits transmitted during one second whereas baud
rate refers to the number of signal units per second that are required to represent those
bits
baud rate =
it rate/N.
where N is no-of-bits rep!
nted by each signal shitt
128. Who are hackers ? Who are crackers ?
Ans. The Crackers are the malicious programmers who break into secure systems
whereas Hackers are more interested in gaining knowledge about computer systems
and possibly using this knowledge for playful pranks.
129. Which of the following will come under Cyber Crime ?
(i) Theft of a brand new sealed pack Laptop
(ii) Access to a bank account for getting unauthorized Money Transaction
(iii) Modification in a company data with unauthorized access
(iv) Photocopying a printed report
Ans.
(id) Access to a bank account for getting unauthorized Money Transaction
130, Discuss how IPod is different from 1Pv6.
‘Ans. Internet Protocol (IP) is a set of technical rules that define how computers
communicate over a network. There are currently two versions : LP version 4 (IPv4) and
IP version 6 (IPV6)
> IPv4 was the first version of Internet Protocol to be widely used and still
accounts for most of today’s Internet traffic. There are just over 4 billion [Pv4
addresses. While that is a lot of IP addresses, it is not enough to last forever.
> IPV6 is a newer numbering system to replace IPv4. It was deployed in 1999 and
provides far more IP addresses, which should meet the need well into the future
The major difference between IPv4 and IPv6 is the number of IP addresses
Although there are slightly more than 4 billion IPv4 addresses, there are more than
16 billion-billion IPv6 addresses.
[ tntemet Protocol veson 4 (1Pvs) | Intemet Protocol vers 6 ane) |
[Address sce [32-bit number [ }28-bit number ree
[Adress formar Dotted decimal notation = Hexadecimal notation
| 192.108.0.202 SFFE0400.2807 SACS. 64 |
[Nunnter of adresses [2092 a 28 = |340
131
132.
134.
135.
'ST_ WITH COMPUTER SCIENCE (Python) ~ xi
What is online banking ?
Ans. Online banking refers to the usage of banking services using online methods
such as the Internet etc. With online banking, the user can use and availa all financial
services of a bank, otherwise available in offline mode.
What is the difference between online banking and net banking ?
Ans. Difference between online banking and mobile banking is that Mobile
banking is done via a mobile banking app while the online baking, is done via secure
website of the bank.
What is e-wallet ? Give examples
Ans, E-wallet refers to availability of own money electronically, which can be used
through various types of online media. Some popular e-wallets are PayTM,
Freecharge, Airtel Money ete.
What is meant by a primary key ?
Ans. A primary key is a field in the table/file that uniquely identifies every record
ina file.
Define the following terms :
(a) relation (b) tuple (©) attributed) domain
(@) primary key (f) candidate key (g) cartesian product
(h) cardinality (i) degree
Ans.
(@) Relation, A relation is a table having atomic values, unique rows and
unordered rows and columns,
() Tuple. A row in a relation is known as tuple.
(©) Attribute, A column of a table is known as an attribute.
(4) Domain. A domain is a pool of values from which the actual values
appearing in a given column are drawn.
(e) Primary key. A primary key is a set of one or more attributes that can
uniquely identify tuples within the relation.
() Candidate key. Alll attribute combinations inside a relation that can serve as
primary key are candidate keys as they are candidates for the primary key
position.
(8) Cartesian product. The cartesian Product of two relations A and B written as
Ax B results into a new relation with all possible combinations of the tuples
of the two relations operated upon. All tuples of first relation are
concatenated with all the tuples of second relation to form the tuples of the
new relation.
(2) Cardinality. The Cardinali
in the relation.
of a relation means the number of tuples (rows)
(® Degree. The degree of a relation means the number of attributes (columns) in
the relation.136.
137.
138.
139.
141
142.
143,
144.
145.
146.
47.
VIVA VOCE QUESTIONS 341
What is data redundancy ? What are the problems associated with it ?
Ans. Duplication of data is data redundancy. It leads to the problems like wastage
of space and data inconsistency.
What is data inconsistency ?
Ans. Multiple-mismatched copies of same data in a database is called Data
Inconsistency.
Differentiate between DDL and DML.
Ans. The DDL provides statements for the creation and deletion of tables and indexes.
The DML provides statements to enter, update, delete data and perform complex
queries on these tables.
What is composite primary key ?
Ans. The primary key which is created on multiple columns in a table is generally
considered as the Composite primary key.
What is the difference between primary key and unique constraints ?
Ans. Primary key cannot have NULL value, the unique constraints can have NULL
values. There is only one primary key in a table, but there can be multiple unique
constrains. The primary key creates the cluster index automatically but the Unique key
does not.
What is a join in SQL? What are the types of joins ?
Ans. An SQL Join statement is used to combine data or rows from two or more
tables based on a common field between them
Name some common DDL commands.
Ans. Create Table, Create Index, Alter Table, Drop table.
Name some common DML commanis.
Ans. Select, Insert Into, Update, Delete
Can you use = comparison operator to compare Null values in a select query ?
‘Ans. No, the operator to compare Null values is ‘is’ operator.
What is the significance of GROUP BY clause in a SQL query ?
Ans. The GROUP BY clause combines all those records that have identical values
ina particular field or a group of fields. This grouping results into one summary record
per group if group-functions are used with it.
What is the significance of the default constraint in SQL ?
Ans. It is used when it come’ to including a default value in a column in case there
is no new value provided at the time a record is inserted.
What is the difference between Delete and Truncate commands ?
‘Ans. The Delete command can delete one or more rows of a relation depending,
upon the given condition.
The Truncate command deletes all the records from a relation.342 MOVE FAST WITH COMPUTER SCIENCE [Pyinon) ~ Xtl
148. What is the difference ‘between DROP TABLE and Truncate commands ?
Ans. The Truncate command deletes all the rows from a table but the table
structure stays, iv., an empty table still lies in the database.
The drop table command removes the table object from the database. After drop
table, no table with the given name exists in the database.
149. What is a constraint ?
Ans. Constraint can be used to specify the limit on the data type of table. Constraint
can be specified while creating or altering the table statement.
Commonly used SQL constraints are
NOT NULL CHECK
DEFAULT UNIQUE
PRIMARY KEY FOREIGN KEY
150. What is database connectivity ?
Ans, Database connectivity refers to connection and communication between an
application and a database system.
151. What is Connection ? What is its role ?
‘Ans. A Connection (represented through a connection object) is the session
between the application program and the database. To do anything with database,
one must have a connection object.
152. What is a result set ?
Ans. A result set refers to a logical set of records that are fetched from the database
by executing a query and made available to the application-program.
153. Which package must be imported in Python to create a database connectivity application?
Ans. There are multiple packages available through which database connectivity
applications can be created in Python. One such package is mysql.connector.
154. What is Online fraud ?
Ans. Fraud committed using the Internet is called Online fraud. Online fraud may
occur in many forms such as : non-delivered goods ; non-existent companies ; stealing
information ; fraudulent payments etc. |
155. What are intellectual property rights ? |
Ans. Intellectual property rights are the rights of the owner of information 0 |
decide how much information is to be exchanged, shared or distributed. Also it gives j
the owner a right to decide the price for doing (exchanging/sharing/ distributing) so.
156. Wihal'db you understand by plagiarism ? Wily 18 it punishable Offence ?
Ans. Plagiarism is the act of using or stealing someone else's intellectual work, ideas
etc. and passing it as your own work. In other words, plagiarism is a failure in giving credit
to its source.
Plagiarism is a fraud and violation of Intellectual property rights. Since intellectual
property holds a legal entity status, violating its owner's right is a legally punishable
offence. i157.
158.
159,
160.
VIVA VOCE QUESTIONS 343
What is digital property ? Give some examples of digital properties.
Ans. Digital property (or digital assets) refers to any information about you or
created by you that exists in digital form, either online or on an electronic storage
evice.
Examples of digital property include : ary online personal accounts (email/social media
accounts! shopping accounts/video gaming accounts, online storage accounts) and personal
websites and blogs ; domain names registered in your name; intellectual properties etc
What is a firewall ?
Ans. A firewall is a device or software that allows/blocks traffic as per defined set
of rules. These are placed on the boundary of trusted and untrusted networks,
What is identity theft ?
Ans. Identity theft refers to the acquisition of personal data of the victim and uses it
for illegal purposes. It is the most common type of fraud that may lead to financial
losses and at times may be held responsible for criminal actions as the victim might be
personified.
Could you tell some common measures one can take to prevent identity theft ?
Ans. Common measures to prevent identity thefts include :
> Ensure the strong and unique password.
> Avoid postings of confidential information online.
> Do not post personal information on social media.
> Shop from known and trusted websites.
= Use the latest version of the browsers.
> Install advanced malware and spyware tools.
> Use specialized security solutions against financial data.
> Always update your system and the software.
> Protect the social security number.
= Download only the well-known apps and share limited details.