You are on page 1of 6

ONE MARKS

1. Which keyword is use for function?

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

2. If return statement is not used inside the function,


the function will return:

a) None
b) 0
c) Null
d) Arbitary value

3. what is the extension of the python file?

a) .py file
b) .pyt file
c) .pn file
d) .pyn file
4. What will be the output of the following Python
code?

g = (i for i in range(5))
type(g)

a) class <’loop’>
b) class <‘iteration’>
c) class <’range’>
d) class <’generator’>

5. _____ represents an entity in the real world with its


identity and behaviour.

a) A method
b) An object
c) A class
d) An operator
6. To read two characters from a file object infile, we
use ____________

a) infile.read(2)
b) infile.read()
c) infile.readline()
d) infile.readlines()

7. The readlines() method returns ____________

a) str
b) a list of lines
c) a list of single characters
d) a list of integers

8. What is the current syntax of remove() a file?

a) remove(file_name)
b) remove(new_file_name, current_file_name,)
c) remove(() , file_name))
d) none of the mentioned

9. Correct syntax of file.writelines() is?

a) file.writelines(sequence)
b) fileObject.writelines()
c) fileObject.writelines(sequence)
d) none of the mentioned

10. Which of the following is not a class method?

a) Non-static
b) Static
c) Bounded
d) Unbounded

11. How an object can become serializable?

a) If a class implements java.io.Serializable class


b) If a class or any superclass implements
java.io.Serializable interface
c) Any object is serializable
d) No object is serializable

12. What is serialization?

a) Turning object in memory into stream of bytes


b) Turning stream of bytes into an object in memory
c) Turning object in memory into stream of bits
d) Turning stream of bits into an object in memory

13. Which of the following methods is used to avoid


serialization of new class whose super class already
implements Serialization?

a) writeObject()
b) readWriteObject()
c) writeReadObject()
d) unSerializaedObject()
14. Serializaed object can be transferred via network.

a) True
b) False

15. How many methods Serializable has?

a) 1
b) 2
c) 3
d) 0

Answers:-
1.(c), 2.(a), 3.(a), 4.(d), 5.(b), 6.(a), 7.(b), 8.(a), 9.(c), 10.
(a), 11.(b), 12.(a), 13.(a), 14.(a), 15.(d)

You might also like