

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
1. |
The copy module uses the ___________________ protocol for shallow and deep copy.(a) pickle(b) marshal(c) shelve(d) copyregThe question was posed to me in quiz.The origin of the question is Pickle Module in division Mapping Functions and Modules of Python |
Answer» The correct answer is (a) pickle |
|
2. |
The module _______________ is a comparatively faster implementation of the pickle module.(a) cPickle(b) nPickle(c) gPickle(d) tPickleThe question was asked in class test.I want to ask this question from Pickle Module topic in division Mapping Functions and Modules of Python |
Answer» The CORRECT option is (a) CPICKLE |
|
3. |
Lambda functions cannot be pickled because:(a) Lambda functions only deal with binary values, that is, 0 and 1(b) Lambda functions cannot be called directly(c) Lambda functions cannot be identified by the functions of the pickle module(d) All lambda functions have the same name, that is, I got this question in an online quiz.My query is from Pickle Module topic in portion Mapping Functions and Modules of Python |
Answer» CORRECT CHOICE is (d) All lambda functions have the same name, that is, The EXPLANATION: Lambda functions cannot be PICKLED because all the lambda functions have the same name, that is, |
|
4. |
If __getstate__() returns _______________ the __setstate__() module will not be called on pickling.(a) True value(b) False value(c) ValueError(d) OverflowErrorThis question was addressed to me by my college professor while I was bunking the class.Query is from Pickle Module in portion Mapping Functions and Modules of Python |
Answer» The correct option is (b) False value |
|
5. |
Which of the following cannot be pickled?(a) Functions which are defined at the top level of a module with lambda(b) Functions which are defined at the top level of a module with def(c) Built-in functions which are defined at the top level of a module(d) Classes which are defined at the top level of a moduleThe question was asked in an online interview.I'm obligated to ask this question of Pickle Module in division Mapping Functions and Modules of Python |
Answer» The correct option is (a) Functions which are defined at the top LEVEL of a MODULE with LAMBDA |
|
6. |
The pickle module defines ______ exceptions and exports _______ classes.(a) 2, 3(b) 3, 4(c) 3, 2(d) 4, 3I had been asked this question in an interview.My doubt stems from Pickle Module topic in chapter Mapping Functions and Modules of Python |
Answer» The correct option is (C) 3, 2 |
|
7. |
Which of the following functions raises an error when an unpicklable object is encountered by Pickler?(a) pickle.PickleError(b) pickle.PicklingError(c) pickle.UnpickleError(d) pickle.UnpicklingErrorThe question was asked in final exam.I want to ask this question from Pickle Module topic in portion Mapping Functions and Modules of Python |
Answer» Correct CHOICE is (b) pickle.PicklingError |
|
8. |
Which of the following functions can accept more than one positional argument?(a) pickle.dumps(b) pickle.loads(c) pickle.dump(d) pickle.loadThe question was asked in final exam.My enquiry is from Pickle Module in portion Mapping Functions and Modules of Python |
Answer» RIGHT answer is (a) pickle.dumps Best explanation: The functions pickle.loads, pickle.dump and pickle.load ACCEPT only ONE argument. The FUNCTION pickle.dumps can accept more than one argument. |
|
9. |
Which of the following functions can be used to find the protocol version of the pickle module currently being used?(a) pickle.DEFAULT(b) pickle.CURRENT(c) pickle.CURRENT_PROTOCOL(d) pickle.DEFAULT_PROTOCOLThis question was addressed to me during an internship interview.The above asked question is from Pickle Module topic in chapter Mapping Functions and Modules of Python |
Answer» Correct ANSWER is (d) PICKLE.DEFAULT_PROTOCOL |
|
10. |
Pick the correct statement regarding pickle and marshal modules.(a) The pickle module supports primarily .pyc files whereas marshal module is used to sterilize Python objects(b) The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this(c) The pickle module cannot be used to sterilize user defined classes and their instances whereas marshal module can be used to perform this task(d) The format of sterilization of the pickle module is not guaranteed to be supported across all versions of Python. The marshal module sterilization is compatible across all the versions of PythonThe question was posed to me in my homework.My doubt stems from Pickle Module in section Mapping Functions and Modules of Python |
Answer» The CORRECT choice is (b) The pickle module KEEPS track of the objects that have already been sterilized whereas the marshal module does not do this |
|
11. |
To sterilize an object hierarchy, the _____________ function must be called. To desterilize a data stream, the ______________ function must be called.(a) dumps(), undumps()(b) loads(), unloads()(c) loads(), dumps()(d) dumps(), loads()The question was posed to me in an online interview.My question is from Pickle Module topic in section Mapping Functions and Modules of Python |
Answer» Right option is (d) dumps(), LOADS() |
|
12. |
The process of pickling in Python includes:(a) conversion of a list into a datatable(b) conversion of a byte stream into Python object hierarchy(c) conversion of a Python object hierarchy into byte stream(d) conversion of a datatable into a listI have been asked this question by my school teacher while I was bunking the class.This intriguing question comes from Pickle Module topic in section Mapping Functions and Modules of Python |
Answer» RIGHT choice is (c) conversion of a Python object HIERARCHY into byte stream Easy explanation - Pickling is the PROCESS of sterilizing a Python object, that is, conversion of a byte stream into Python object hierarchy. The reverse of this process is known as UNPICKLING. |
|
13. |
The function used to alter the thickness of the pen to ‘x’ units:(a) turtle.width(x)(b) turtle.span(x)(c) turtle.girth(x)(d) turtle.thickness(x)This question was addressed to me in an online quiz.The question is from Turtle Module topic in section Mapping Functions and Modules of Python |
Answer» Right CHOICE is (a) turtle.width(X) |
|
14. |
Which of the following functions results in an error?(a) turtle.shape(“turtle”)(b) turtle.shape(“square”)(c) turtle.shape(“triangle”)(d) turtle.shape(“rectangle”)The question was posed to me in my homework.Question is from Turtle Module in division Mapping Functions and Modules of Python |
Answer» The CORRECT choice is (d) turtle.shape(“RECTANGLE”) |
|
15. |
Which of the following functions returns a value in degrees, counterclockwise from the horizontal right?(a) heading()(b) degrees()(c) position()(d) window_height()I got this question in an interview.This interesting question is from Turtle Module in chapter Mapping Functions and Modules of Python |
Answer» The correct choice is (a) heading() |
|
16. |
The command used to set only the x coordinate of the turtle at 45 units is:(a) reset(45)(b) setx(45)(c) xset(45)(d) xreset(45)The question was posed to me during an online interview.Question is from Turtle Module in chapter Mapping Functions and Modules of Python |
Answer» The correct CHOICE is (b) setx(45) |
|
17. |
In which direction is the turtle pointed by default?(a) North(b) South(c) East(d) WestThis question was addressed to me in an online quiz.This interesting question is from Turtle Module in section Mapping Functions and Modules of Python |
Answer» Right option is (c) East |
|
18. |
Which of the following functions can be used to make the arrow black?(a) turtle.color(0,1,0)(b) turtle.color(1,0,0)(c) turtle.color(0,0,1)(d) turtle.color(0,0,0)The question was asked in an online interview.The above asked question is from Turtle Module in division Mapping Functions and Modules of Python |
Answer» Right choice is (d) turtle.color(0,0,0) |
|
19. |
Which of the following functions does not accept any arguments?(a) position(b) fillcolor(c) goto(d) setheading()The question was asked in an online quiz.Question is from Turtle Module topic in section Mapping Functions and Modules of Python |
Answer» Correct OPTION is (a) POSITION |
|
20. |
The command which helps us to reset the pen (turtle):(a) turtle.reset(b) turtle.penreset(c) turtle.penreset()(d) turtle.reset()I have been asked this question in an online quiz.The doubt is from Turtle Module topic in portion Mapping Functions and Modules of Python |
Answer» Correct choice is (d) turtle.RESET() |
|
21. |
Which of the following can be used to create a symbolic link?(a) os.symlink()(b) os.symb_link()(c) os.symblin()(d) os.ln()This question was addressed to me in an interview for job.Asked question is from Operating System in division Mapping Functions and Modules of Python |
Answer» Correct ANSWER is (a) os.symlink() |
|
22. |
Which of the following can be used to create a directory?(a) os.mkdir()(b) os.creat_dir()(c) os.create_dir()(d) os.make_dir()This question was posed to me at a job interview.My question is from Operating System in chapter Mapping Functions and Modules of Python |
Answer» Right CHOICE is (a) os.MKDIR() |
|
23. |
What does os.link() do?(a) create a symbolic link(b) create a hard link(c) create a soft link(d) none of the mentionedThis question was addressed to me in semester exam.My query is from Operating System topic in portion Mapping Functions and Modules of Python |
Answer» The correct answer is (B) CREATE a HARD link |
|
24. |
Which of the following returns a string that represents the present working directory?(a) os.getcwd()(b) os.cwd()(c) os.getpwd()(d) os.pwd()The question was asked at a job interview.This interesting question is from Operating System topic in chapter Mapping Functions and Modules of Python |
Answer» CORRECT answer is (a) os.getcwd() The explanation is: The function getcwd() (get CURRENT working DIRECTORY) returns a STRING that represents the PRESENT working directory. |
|
25. |
Which of the following functions can be used to read data from a file using a file descriptor?(a) os.reader()(b) os.read()(c) os.quick_read()(d) os.scan()The question was asked at a job interview.The query is from Operating System topic in division Mapping Functions and Modules of Python |
Answer» The CORRECT choice is (b) os.read() |
|
26. |
What does os.fchmod(fd, mode) do?(a) change permission bits of the file(b) change permission bits of the directory(c) change permission bits of either the file or the directory(d) none of the mentionedThe question was asked in semester exam.The above asked question is from Operating System topic in section Mapping Functions and Modules of Python |
Answer» CORRECT option is (a) change PERMISSION bits of the FILE The BEST explanation: The arguments to the function are a file DESCRIPTOR and the new mode. |
|
27. |
What does os.close(f) do?(a) terminate the process f(b) terminate the process f if f is not responding(c) close the file descriptor f(d) return an integer telling how close the file pointer is to the end of fileThe question was asked during an interview.My enquiry is from Operating System topic in portion Mapping Functions and Modules of Python |
Answer» The correct OPTION is (C) CLOSE the file descriptor f |
|
28. |
What does os.getlogin() return?(a) name of the current user logged in(b) name of the superuser(c) gets a form to login as a different user(d) all of the mentionedI have been asked this question by my school teacher while I was bunking the class.I'd like to ask this question from Operating System in section Mapping Functions and Modules of Python |
Answer» The CORRECT CHOICE is (a) name of the current user LOGGED in |
|
29. |
What does print(os.geteuid()) print?(a) the group id of the current process(b) the user id of the current process(c) both the group id and the user of the current process(d) none of the mentionedThis question was addressed to me in an online quiz.My enquiry is from Operating System in section Mapping Functions and Modules of Python |
Answer» The CORRECT OPTION is (B) the user ID of the current process |
|
30. |
What does os.name contain?(a) the name of the operating system dependent module imported(b) the address of the module os(c) error, it should’ve been os.name()(d) none of the mentionedI have been asked this question during an internship interview.This key question is from Operating System topic in chapter Mapping Functions and Modules of Python |
Answer» Correct answer is (a) the name of the operating system dependent MODULE IMPORTED |
|
31. |
The output of the function len(sys.argv) is ____________(a) Error(b) 1(c) 0(d) Junk valueI had been asked this question by my school teacher while I was bunking the class.Origin of the question is Sys Module in chapter Mapping Functions and Modules of Python |
Answer» The CORRECT OPTION is (b) 1 |
|
32. |
To obtain a list of all the functions defined under sys module, which of the following functions can be used?(a) print(sys)(b) print(dir.sys)(c) print(dir[sys])(d) print(dir(sys))I got this question in a national level competition.This intriguing question comes from Sys Module topic in division Mapping Functions and Modules of Python |
Answer» Right option is (d) print(DIR(sys)) |
|
33. |
The output of the functions len(“abc”) and sys.getsizeof(“abc”) will be the same.(a) True(b) FalseThis question was posed to me in an interview.The origin of the question is Sys Module topic in section Mapping Functions and Modules of Python |
Answer» CORRECT choice is (B) False Best explanation: The function len returns the length of the string passed, and hence it’s output will be 3. The function getsizeof, present under the sys module returns the SIZE of the object passed. It’s output will be a value much LARGER than 3. Hence the above statement is false. |
|
34. |
Which of the following functions is not defined under the sys module?(a) sys.platform(b) sys.path(c) sys.readline(d) sys.argvI got this question during an online exam.This key question is from Sys Module in portion Mapping Functions and Modules of Python |
Answer» Correct ANSWER is (C) SYS.readline |
|
35. |
Which of the following functions can help us to find the version of python that we are currently working on?(a) sys.version(b) sys.version()(c) sys.version(0)(d) sys.version(1)This question was posed to me in homework.My enquiry is from Sys Module in section Mapping Functions and Modules of Python |
Answer» The correct answer is (a) sys.VERSION |
|
36. |
What is the range of values that random.random() can return?(a) [0.0, 1.0](b) (0.0, 1.0](c) (0.0, 1.0)(d) [0.0, 1.0)The question was asked during a job interview.Question is from Random Module topic in section Mapping Functions and Modules of Python |
Answer» The CORRECT ANSWER is (d) [0.0, 1.0) |
|
37. |
Which type of elements are accepted by random.shuffle()?(a) strings(b) lists(c) tuples(d) integersI got this question by my school teacher while I was bunking the class.Query is from Random Module in division Mapping Functions and Modules of Python |
Answer» RIGHT OPTION is (B) lists For explanation: Strings and tuples are immutable and an integer has no LEN(). |
|
38. |
What does random.shuffle(x) do when x = [1, 2, 3]?(a) error(b) do nothing, it is a placeholder for a function that is yet to be implemented(c) shuffle the elements of the list in-place(d) none of the mentionedThis question was posed to me during an interview for a job.The query is from Random Module topic in division Mapping Functions and Modules of Python |
Answer» Correct CHOICE is (c) shuffle the ELEMENTS of the list in-place |
|
39. |
Which of the following will never be displayed on executing print(random.choice({0: 1, 2: 3}))?(a) 0(b) 1(c) KeyError: 1(d) none of the mentionedI had been asked this question in my homework.This is a very interesting question from Random Module topic in division Mapping Functions and Modules of Python |
Answer» Correct answer is (a) 0 |
|
40. |
Which of the following will not be returned by random.choice(“1 ,”)?(a) 1(b) (space)(c) ,(d) none of the mentionedThis question was addressed to me in an internship interview.I want to ask this question from Random Module in chapter Mapping Functions and Modules of Python |
Answer» RIGHT answer is (d) none of the mentioned Best EXPLANATION: Any of the characters PRESENT in the string MAY be returned. |
|
41. |
Which of the following is equivalent to random.randint(3, 6)?(a) random.choice([3, 6])(b) random.randrange(3, 6)(c) 3 + random.randrange(3)(d) 3 + random.randrange(4)The question was asked at a job interview.I'm obligated to ask this question of Random Module in chapter Mapping Functions and Modules of Python |
Answer» The correct option is (d) 3 + random.randrange(4) |
|
42. |
The function random.randint(4) can return only one of the following values. Which?(a) 4(b) 3.4(c) error(d) 5I had been asked this question in an interview for job.This is a very interesting question from Random Module in section Mapping Functions and Modules of Python |
Answer» The correct choice is (C) ERROR |
|
43. |
Which of the following is equivalent to random.randrange(3)?(a) range(3)(b) random.choice(range(0, 3))(c) random.shuffle(range(3))(d) random.select(range(3))I had been asked this question in an online quiz.The question is from Random Module in chapter Mapping Functions and Modules of Python |
Answer» Right answer is (b) random.choice(range(0, 3)) |
|
44. |
Which of the following cannot be returned by random.randrange(4)?(a) 0(b) 3(c) 2.3(d) none of the mentionedI got this question in a national level competition.My question is from Random Module in chapter Mapping Functions and Modules of Python |
Answer» The correct ANSWER is (c) 2.3 |
|
45. |
What the does random.seed(3) return?(a) True(b) None(c) 3(d) 1This question was posed to me in class test.I'm obligated to ask this question of Random Module topic in chapter Mapping Functions and Modules of Python |
Answer» Correct choice is (B) None |
|
46. |
The randrange function returns only an integer value.(a) True(b) FalseThe question was asked in an online quiz.My question is taken from Random module topic in division Mapping Functions and Modules of Python |
Answer» The correct option is (a) True |
|
47. |
Both the functions randint and uniform accept ____________ parameters.(a) 0(b) 1(c) 3(d) 2This question was addressed to me in a job interview.The doubt is from Random module topic in portion Mapping Functions and Modules of Python |
Answer» Right CHOICE is (d) 2 |
|
48. |
What is the interval of the value generated by the function random.random(), assuming that the random module has already been imported?(a) (0,1)(b) (0,1](c) [0,1](d) [0,1)I got this question by my school principal while I was bunking the class.Origin of the question is Random module in portion Mapping Functions and Modules of Python |
Answer» Correct choice is (d) [0,1) |
|
49. |
To include the use of functions which are present in the random library, we must use the option:(a) import random(b) random.h(c) import.random(d) random.randomI had been asked this question in an interview for job.My question is taken from Random module topic in division Mapping Functions and Modules of Python |
Answer» CORRECT option is (a) import RANDOM The best I can explain: The COMMAND import random is used to import the random MODULE, which enables us to use the functions which are present in the random library. |
|
50. |
Which of the following functions helps us to randomize the items of a list?(a) seed(b) randomise(c) shuffle(d) uniformThis question was posed to me by my school principal while I was bunking the class.I want to ask this question from Random module in section Mapping Functions and Modules of Python |
Answer» The CORRECT choice is (C) shuffle |
|