Set A
Set A
Section –A
Q.1. State True or False: “Lists and dictionaries are mutable.” 01
In complex number a+ib , b represents as
Q.2. 01
a) Real part b) Imaginary Part c) Special part d) None of these
Given an object ob1 = (10, 20, 30, 40, 50, 60, 70, 80, 90). What will be the output of
Q.3. print(ob1[3:7:2])? 01
a) (40, 50, 60, 70, 80) b) (40, 50, 60, 70) c) (40, 50, 60) d) (40, 60)
Which of the following is the correct output for the execution of the following Python statement?
Q.4. print(5+3**2/2) 01
a) 32 b) 8.0 c) 9.5 d) 32.0
sub = “PYTHON”
for i in sub :
print ( i, ‘ ‘ , end=” “)
a) P Y T H O N b) P c) None d) P,Y,T,H,O,N
Q.5. 01
Y
T
H
O
N
Which path does not start with a leading forward slash?
Q.6. 01
a) Relative b) Absolute c) Both a) and b) d) None of these
Which of the following Python function displays the memory id of a variable?
Q.7. 01
a) Type() b) str() c) getid() d) id()
Which of the following operator performs an integer division?
Q.8. 01
a) * b) // c) / d) **
Observe the following tuples and choose the correct option:
T1=(4 , 7 , 8 , 9)
T2=(0 , 4 , 3)
Q.9. >>>T=T1+T2 01
>>> print(T)
a) (4 , 7 , 8 , 9 , 0 , 4 , 3) b) (4 , 7 , 8 , 9 , 4 , 7 , 8 , 9) c) (4 , 7 , 8 , 9) d) None of these
Which of the following functions will read entire contents of a text file?
Q.10. 01
a) Read() b) readfull() c) readline() d) readfile()
Assume that the position of the file pointer is at the beginning of the 3rd line in a text file. Which of
Q.11. the following option can be used to read all the remaining lines? 01
a) myfile.read(n-3) b) myfile.read(n) c) myfile.readline() d) myfile.readlines()
………….is the base protocol for all application protocol.
Q.12. 01
a) FTP b) TCP/IP c) IRCP d) Telnet
……………is a protocol used for uploading and downloading of files in a network?
Q.13. 01
a) SMTP b) FTP c) PPP d) VOIP
Which of the following is the correct output for the following execution?
Q.14. print(print(“Biscope”)) 01
a) Biscope b) None c) Biscope d) Error
Which of the following functions write data to a binary file?
Q.15. 01
a) Pickle() b) writer() c) load() d) dump()
What is the default value of host?
Q.16. 01
a) Host b) localhost c) globalhost d) None of these
Directions : (Q No. 17 and 18) are Assertion and Reason based questions.
Assertion (A) : Built-in functions are predefined in the system and can be directly used in any
program.
Reason (R) : id() and type()are built-in functions in python.
Q.17. 01
a) Both A and R are true and R is the correct explanation for A.
b) Both A and R are true but R is not the correct explanation for A.
c) A is true but R is false.
d) A false but R is true.
Assertion (A): The CSV files are like TEXT files and are comma separated value files.
Reason (R) : The data stored in CSV files are separated by comma by default. Although the
delimiter can be changed.
Q.18. a) Both A and R are true and R is the correct explanation for A. 01
b) Both A and R are true but R is not the correct explanation for A.
c) A is true but R is false.
d) A is false but R is true.
Section - B
Riya was asked to accept a list of even numbers, but she did not put the relevant condition while
accepting the list of numbers. She wrote a user-defined function oddtoeven(L) that accepts the list
L as an argument and converts all the odd numbers into even by multiplying them by 2.
def oddtoeven(L)
Q.19. for i in range (size(L)): 02
if (L[i]%2 ! == 0)
L[i] = L[i] ** 2
print(L)
There are some errors in the code, Rewrite the correct code.
How are E-mail and chat application different?
Q.20. OR 02
How are LAN and MAN different?
Observe the code and write the output
a) ‘arihant publication ‘. count (‘hant’ , 0 , 10)
b) dic={}
dic[(1,2,4)]=8
dic[(4,2,1)]=10
Q.21. 02
dic[(1,2)]=24
sum=0
for i in dic:
sum = sum + dic[i]
print(sum)
Write any two disadvantages of star topology.
Q.22. OR 02
Why a switch is called an intelligent hub?
a) Write the full forms of i) URL ii)VOIP
Q.23. 02
b) Write the use of SMTP.
Q.24. Find the output of the following code: 02
dic={“Nitin”:(21,”NIIT”),”Ankit”:(15,”NIIT”)}
print(“The original dictionary:”,str(dic))
result=[(key,i,j)for key,(i,j) in dic.items()]
print(“The list after conversion : ” ,str(result))
OR
What output will be generate when the following python code is executed?
def changeList():
Li=[]
Li01=[]
Li02=[]
for i in range(1,10):
Li.append(i)
for i in range(10,1,-2):
Li01.append(i)
for i in range(len(Li01):
Li02.append(li01[i]+li[i])
Li02.append(len(Li)-len(Li01))
print(Li02)
changeList()
Write the full forms of the following: a) WAN b) GSM
Q.25. OR 02
Write down the expansion of Modem. Also, write its role in a network.
Section – C
Write a program in Python to open a text file “Lines.txt” and display all those words whose length
Q.26. 03
is greater than 5.
Write a function countEU() in python, which should read each character of a text file IMP.TXT
should count and display the occurrence of alphabets E and U (including small cases e and u too).
OR
Write a python program to find the longest word in file “status.txt”. if contents of status.txt are
welcome to your one-step solutions for all your study, practice and assessment need for various
competitive and recruitment examinations and school segment. We have been working tirelessly
for over a decade to make sure that you have best in class study resources because you deserve
SUCCESS AND NOTHING LESS…..
Output should be:
Longest word: examinations
Consider the following stack of characters , where STACK is allocated N=8 memory cells.
STACK : A, C, D, F, K,…. , ……, ……..
Describe the STACK at the end of the following operations. Here, POP and PUSH are algorithm for
deleting and adding an element to the stack.
a) POP (STACK, ITEM)
Q.28. 03
b) POP (STACK, ITEM)
c) PUSH (STACK, L)
d) PUSH (STACK , P)
e) POP (STACK, ITEM)
f) PUSH (STACK, R)
Write the definition of a function Reverse(x) in python, to display the elements in reverse order
such that each displayed element is the twice of the original element (element * 2) of the list x in
the following manner:
Example :
If list x contains 7 integers is as follows:
Q.29. 03
X[0] X[1] X[2] X[3] X[4] X[5] X[6]
4 8 7 5 6 2 10
After executing the function, the array content should be displayed as follows:
20 4 12 10 14 16 8
Q.30. Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a 03
program, with separate user defined functions to perform the following operations.
a) Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value (marks) is greater than 75.
b) Pop and display the content of the stack.
For example: if the sample content of the dictionary is as follows
R={“OM”:76,”JAI”:45,”BOB”:89,”ALI”:65,”ANU”:90,”TOM”:82}
The output from the program should be
TOM ANU BOB OM
OR
Arnav has a list containing 10 integers. You need to help him create a program with separate user
defined functions to perform the given operations based on the list.
a) Traverse the content of the list and push the even numbers into a stack.
b) Pop and display the content of the stack.
For example: if the sample content of the list is as follows:
N=[12,13,34,56,21,79,98,22,35,38]
Sample output of the code should be:
38 22 98 56 34 12
Section - D
Red Pandas infosystems has its 4 blocks of buildings. The number of computers and distances
between them is given below:
b) Write a python program to remove the characters of odd index values in a string.
What is aCSV file? When do we use CSV file? Write a program using using one function:
addCustomer(): To write customer code, customer name and amount in file “cust.csv”.
The details of the customer are as follows:
Q.33. 05
[‘custcode’, ‘custName’, ‘Amount’]
[‘001’, ‘Nihir’, ‘8000’]
[‘104’ , ’Akshay’ , ’5000’]
Section - E
What do you mean by file? What do you mean by file handling?
Explain open() function with its syntax.
Q.34. 04
OR
What is the difference between HTML and XML? Write at least 04 differences.
Write a python code to perform the following using two user defined functions.
a) showData(): To display only roll no and student name of the file “Student.csv”
Roll No, Name, Marks,
Q.35. 01, Nilesh, 65 04
02, Akshay, 75
showSelect(): To display only roll number and marks of the students from the CSV file
“student.csv”