Important Points To Ponder
Important Points To Ponder
1001 60000 12
1002 70000 15
1004 55000 17
Table : ITEM
ITCODE ITEMTYPE
12 STATIONARY
15 HOSIERY
17 BAKERY
If in a print( ) function, normal variables are included along with methods, the methods will be
evaluated first and then the output will be shown as the order in the print statement. For eg:
L= [34,25,56,78,12]
print( L, L.pop(), sorted(L))
[34, 25, 56, 78] 12 [25, 34, 56, 78]
NOTE: The pop() method would have removed the last element and when L is shown in the print
command, the changed list only will be displayed(though L is in the 1st position in the print
command)
When using fromkeys() to create a dictionary, the 1st argument will an iterable whose elements will
be used as keys of the new dictionary and the 2nd argument will the common value for all the keys.
But if the 2nd argument is a list and for one of the keys you change the list content, the changed list
will be reflected for all the keys:
D={}.fromkeys((100,200,300),[4,5])
print(D)
{100: [4, 5], 200: [4, 5], 300: [4, 5]}
D[200][1]=500
print(D)
{100: [4, 500], 200: [4, 500], 300: [4, 500]}
(Because all the values which is in the form of a list are obviously in a common memory location and
lists are mutable. It is like referencing a list: L1=[3,4] ; L2=L1 ; L2[0]=300; Both L1, L2 will be
[300,4]
In a list of values, if the insert method when used has a subscript that is not available in the list, then the
new element will only be appended:
Given l=[10,20]
l.insert(5,100) #note – subscript 5 does not exist
print(l) - will show
[10, 20, 100]
l.index(100)
2
In a text file, to write one statement to fetch data for whichever of the following condition is first met :
if ‘n’ bytes of characters are to be retrieved or till the ‘\n’ is encountered
the command will be: F.readline(n)
The del statement can be used with slice only with lists and not tuples
L=[4,6,3,10]
del L[1:3]
print(L)
[4, 10]
T=(4,6,3,10)
del T[1:3]
TypeError
If in a slice, the given range involves an ending subscript not available, the content from the beginning
subscript until the end of the content are retrieved.
(eg)
M = “EXAM”
print(M[3:20]) will show M
L= [4,6,3,9]
print(L[-1:10]) will show [9], because [-1:10] will be treated as L[3:10]
If F is the file object, to position the file pointer at the 50th byte from the beginning : F.seek(50)
To position the file pointer to read the (or from the) 50th character from the beginning : F.seek(49)
The network protocol that translates domain names into IP addresses to make the internet more user-friendly.- ,
DNS (Domain Name System) . (eg) DNS translates domain names like "mysite.com" into IP addresses like
"142.250.184.147
1 AAA SAVING
2 BBB CURRENT
3 CCC CURRENT
4 DDD NULL
TYPE
SAVING
CURRENT
NULL
COUNT(DISTINCT TYPE)
2
(Because only count(*) will include NULLs; count(argument), where argument can be any attribute or
DISTINCT clause, will ignore NULLs
Even though floor division // operator is supposed to get the nearest lowest integer, if any one of the
operand(numerator or denominator) is a float the final answer must be a float
print(-3.56//9)= -1.0
print(1.125//-5)=-1.0
print(1.125//5)=0.0
Keyword arguments of connect must be in lower case(host, user, password, database). If the
Password is given as a number(like 123) that also should be in quotes.
If a slice is used on the LHS and an iterable on the RHS, the elements satisfying the slice will be
replaced by the elements of the iteable
L=[8,4,2]
L[:2]='poll'
L will now have [p,o,L,L,2]
If the formal parameter of a function header is given a default argument and is immutable every time the
function is called with a missing actual argument, the formal parameter will take the same default value.
Like:
def fn(a=10):
a=a+5
print(a)
for k in range(3):
fn()
But If the formal parameter of a function header is given a default argument and is mutable every time
the function is called with a missing actual argument, the formal parameter will take the changed value of
the formal paramter. Like:
(eg-1)
def fn(a=[]):
a.append(5)
print(a)
for k in range(3):
fn()
(eg-2)
def fn(y,a={}):
a.setdefault(y,10)
print(a)
for k in range(1,4):
fn(k)
L+=range(1,10,4); print(L) will show [6, 8, 12, 10, 20, 9, 2, 'h', 'a', 'i', 1, 5, 9]
To have a string content across multiple lines using – triple quotes, using continuation character \
and using the escape sequence character \n – the effect of using len()
t="""hello
world"""
print(len(t)) --- 11
t="hello\nworld"
print(len(t)) --- 11
t="hello\
world"
print(len(t)) --- 10
Make a note of the datatype of the return value of methods (whether int/ str/ bool/ list/ tuple/
dictionary/ None etc)
Also make a note of methods which do not return a value ( so when used in a print() function or
assigned to a LHS variable it will be None) which means they work on & affect the original variable
1) String – all methods return a value
2) List- append(), extend(), sort(), reverse(), remove(), insert() - returns None [
index(), count(), pop() – will return a value]
3) Tuple- The 2 methods of tuple- index(), count() – will return some value(int)
4) Dictionary- clear(), update()
[get(), items(), keys(), values(), pop(), popitem(), setdefault(),fromkeys() – will return value]
The Augmented Assignment operator or the Arithmetic assignment operator( shorthands +=, -=, *=,
/=, %=, **= etc) has the least priority when evaluated in a mixed mode expression
(Eg A=53; B=24; C=5; C += A//B * (15 > 7 and 99) ; print(C) will result in 203 Short
hand happens after the RHS is evaluated.
In a list when a slice is used in the LHS and is assigned to something on the RHS, from the starting
index of the slice, the RHS values are inserted in the list, replacing the result of the slice (that is the
elements in the result of the slice will be deleted). For eg
Odd=[1,9,15,22,35,67]
Odd.insert(1,3) # list will now be: [1,3,9,15,22,35,67]
Odd[2:4]=[5,8] #will result in [1,3,5,8,22,35,67] – starting from subscript 2,
5&8 will be inserted, replacing the result of [2:4] (which is
index 2,3)
Odd[3:3]=[100,120] #will result in [1,3,5,100,120, 8, 22,35,67] – starting from
subscript 3, 100&120 will be inserted, replacing the result of
[3:3] (which will be empty – so no elements are replaced)
Similarly, if a subscript is used to assign a empty list [], the element in that subscript is replaced by
the [] but is a slice is used, all elements resulting from the slice will be deleted.
Odd[3]= [] #will result in [1,3,5,[ ],120, 8, 22,35,67]
Odd[-3:] = [ ] #will result in [1,3,5,[ ],120, 8 ]
Append method takes one parameter and adds it to the end of the list. If the parameter is a list itself
it is added to the existing list as a list. For eg
L= [ ]
L.append(100)
print(L) #will show [100]
L=[ ]
L.append([10,4, [5,3,1], 15 ])
print(len(L)) #will show 1
print(L[0][2][0]) # will show 5
The arithmetic operator // refers to floor division which generally truncates the floating point result
to give an integer like
53//24 will be 2 whereas 53/24 will be 2.2083333333333335
But if the numerator or denominator (or both) is a float, result of the floor division operator will be
a float, like
53.0//24 will be 2.0
And if the numerator or denominator is negative, result will be the floor(nearest SMALLEST value)
like:
-53//24 will be -3
53//-24 will be -3
-53//-24 will be 2
In a list along with numerals if Boolean values are given and if a sort() method is performed the
numerical representation of the Boolean values (False -0 , True-1) will be considered to perform the
operation but will store the data as Boolean value only, like:
B=[4, -2, 8, 6, 5, True, False]; B.sort();print(B) will result in
[-2, False, True, 4, 5, 6, 8]
If a module is not imported but its function is used, it will throw NameError
(eg) print(math.ceil(9.5)) without import math statement included
The order in which statements are interpreted/executed is of utmost importance. Consider this UDF:
(line numbers have been included to understand the order of interpretation)
1. a=100
2. def fn(p=a):
a. print(p+10)
3. a=120
4. fn()
5. print(a)
(changed in line3)
For questions on writing UDFs involving lists/stacks, include a line(either as part of the code itself or
a comment) showing the stack to be globally declared in the main (unless the stack is one of the
If UDFs asked for file creation is asked, check if the question mentions about appending a record or
records, as in the latter case ‘n’ has to be read from the user indicating how many records and a loop
to be used to read & write ‘n’ records
In output questions on files, if the opening mode is r / r+ / w/ w+ / rb/ rb+ / wb/ wb+, immediately
on opening, the file size ( found using tell()) will be zero.
Only if the opening mode is a/a+/ab/ab+ on opening itself the file pointer is taken to the end of the
file and tell() will give the file size.
In text file codes, (generally all code/output questions) if an output format is given with the sample
input, your code should have statements to obtain that given output format (eg: No. of times M
Networks
● For 1 mark, write atleast 2 ad/disad
● Expand abbreviations before explaining
● For drawing layouts go for least total cable length; draw neat block diagrams using scale
& pencil
● For star topology : make sure the node chosen as central node(in your layout diagram)
has the server.
● Server in the building with max. no. of computers
● Modem is where server is placed
● Hub/switch in all buildings
● Repeaters between buildings with distance more than 100m
● For hilly terrain- no microwave/optical fiber. Onlyunguided media – satellite or radio
waves
● For internet connection – TCP/IP, leased line, modem, DSL, dialup, broadband
● Efficient way of connecting computers within a building – switch. Other wise Hub /
switch can be the answer
● Efficient topology for LAN- STAR. (So based on less cable length – BUS and based on
efficiency STAR can be quoted)
● URL eg : http://www.google.com
Domain name: google.com
2) Write the key features differentiating Web 1.0, Web 2.0 and Web 3.0:
Web1.0 – Static HTML pages. 2.0-Added features(blogs, wikis, social networking sites) to
make the web more interactive/interoperable/online-information exchange. 3.0 – new
technologies like AI, ML, Blockchain, 2D/3D immersive user experience, greater surety &
privacy
3) Advantages of 3G over 2G :
Faster web browsing
Faster file transfer
Better video clarity
Better security
4) PAN – Personal area network ; network organized around a person using his
mobiles, laptops etc. LAN – Local area network; network organized around computers
within a building / campus covering an area upto 1 Km.
6) Fastest media out of Optical fibre, Coaxial cable, Ethernet cable, Microwave,
Infrared. : Guided – Optical fibre; Unguided – Microwave / Infra red