0% found this document useful (0 votes)
68 views

JOCPython 2023 S2 Question Bank

The document contains questions about programming concepts like Scratch, Python and algorithms. It tests knowledge on topics like control structures, variables, lists, functions and more through multiple choice questions.

Uploaded by

avnidtu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

JOCPython 2023 S2 Question Bank

The document contains questions about programming concepts like Scratch, Python and algorithms. It tests knowledge on topics like control structures, variables, lists, functions and more through multiple choice questions.

Uploaded by

avnidtu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 142

Question 1

PARLE is related to QCUPJ in the same way as DABUR is related to ______.

a) QDSFA
b) ACIED
c) HEAIS
d) ECEYW

Saish Jaiswal | IIT Madras


Question 2
Which of the following is/are control commands in Scratch?

a) repeat
b) repeat until
c) forever
d) forever until

Saish Jaiswal | IIT Madras


Question 3
Which option in scratch is used to wait between the commands:

a) Event
b) Sensing
c) Control
d) Operators

Saish Jaiswal | IIT Madras


Question 4
_________ command is used to make the sprite walk by certain steps.

a) Hide
b) Delete
c) Move
d) Walk

10

Saish Jaiswal | IIT Madras


Question 5
The command used to make the sprite disappear from the animation stage is
_________.

a) Show
b) Hide
c) Delete
d) Move

12

Saish Jaiswal | IIT Madras


Question 6
What is the extension of a scratch file?

a) py
b) se
c) sb
d) sc

14

Saish Jaiswal | IIT Madras


Question 7
Predict the output of the following:

a) 0
b) 100
c) 20
d) None of the above

16

Saish Jaiswal | IIT Madras


Question 8
Which of the following is a facility provided by scratch to use sound effects?

a) A sound library is provided


b) Sound can be recorded using a microphone
c) We can use sound file
d) None of the above

18

Saish Jaiswal | IIT Madras


Question 9
___________ scratch constructs are used to keep doing a set of instructions
infinitely?

a) ever
b) forever
c) never
d) None of the above

20

Saish Jaiswal | IIT Madras


Question 10
In addition to an option of using the inbuilt sprite library in scratch, what are the
other ways to use a sprite?

a) We can paint a custom sprite


b) We can use the camera to take pictures
c) We can upload an image from our computer
d) All of the above

22

Saish Jaiswal | IIT Madras


Question 11
Which of the following commands would make the sprite move backward?

a) Move 10 steps
b) Move -10 steps
c) Both 1 and 2
d) Neither 1 and 2

24

Saish Jaiswal | IIT Madras


Question 12
Which of the following is true about scratch?

a) We cannot add sound to our animations.


b) We cannot make a picture disappear.
c) We can run a forever loop.
d) We cannot make new variables.

26

Saish Jaiswal | IIT Madras


Question 13
What will be the value of “my variable” at the end?

Ans: 40

28

Saish Jaiswal | IIT Madras


Question 14
What will be the value of “my variable” at the end?

Ans: 22

30

Saish Jaiswal | IIT Madras


Question 15
What will the sprite say?

Ans: 0, 1, 2, 3, 4, 5 (after each second)

32

Saish Jaiswal | IIT Madras


Question 16
What will the sprite say?

Ans: Table of 5 34

Saish Jaiswal | IIT Madras


Question 1 (from previous week)
What will the sprite say?

Ans: Table of 5 4

Saish Jaiswal | IIT Madras


Question 2
What are the applications of Python?

a) Image processing and graphic design applications


b) Enterprise and business applications development
c) Operating systems
d) All of the above
e) None of the above

Saish Jaiswal | IIT Madras


Question 3
Which of the following is not a correct variable name

a) Abc
b) Abd23
c) 32asd
d) Ab_cd_23

Saish Jaiswal | IIT Madras


Question 4
What will be the output of this code?

a) Earth is round
Moon has lots of dust.
b) Earth is
round
Moon has lots of dust.
c) Earth is round. Moon has lots of dust. 11

d) Earth is round Moon has lots of dust.


Saish Jaiswal | IIT Madras
Question 5
Predict the output of the following code:

L = [[1,2,3],[0,4,5],[0,0,6]]

for i in range(3):
for j in range(2,i-1,-1):
print(L[i][j], end=“”)

a) 3,2,1,5,4,6
b) 321546
c) 0,0,0,0,0,0
d) 000000

13

Saish Jaiswal | IIT Madras


Question 6
Find all the error(s)in the following code:

a) Index out of range


b) Syntax error
c) Variable not defined
d) 'int' object does not support item assignment

15

Saish Jaiswal | IIT Madras


Question 7
What is the output of the following code:

a) [0,1,2] (5,3,4)
b) [0,1,2] (5,)
c) [0] (5,3,4)
d) [0] (5,)

17

Saish Jaiswal | IIT Madras


Question 1
What will be the output of this code?

a) Earth is round
Moon has lots of dust.
b) Earth is
round
Moon has lots of dust.
c) Earth is round. Moon has lots of dust. 5

d) Earth is round Moon has lots of dust.


Saish Jaiswal | IIT Madras
Question 2
___________ is the method to insert an item into a specified position in a list.

a) Push
b) Write
c) Insert
d) All of the above

Saish Jaiswal | IIT Madras


Question 2
___________ is the method to insert an item into a specified position in a list.

a) Push
b) Write
c) Insert
d) All of the above

Saish Jaiswal | IIT Madras


Question 3
Which method returns the number of occurrences of an element in a list.

a) Number of
b) Total
c) Count
d) Length

10

Saish Jaiswal | IIT Madras


Question 4
The function random.randint(1,100) in python generates.

a) A random integer between 1 to 100 with 1 and 100 both inclusive


b) A random integer between 1 to 100 with 1 and 100 both exclusive
c) A random integer between 1 to 100 with only 100 inclusive
d) None of the above

12

Saish Jaiswal | IIT Madras


Question 5
The method open(“file1.txt”, r+) opens the file file1.txt in __________________.

a) Read only mode


b) Write only mode
c) Read Write mode
d) None of the above

14

Saish Jaiswal | IIT Madras


Question 6
Consider the list L= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]. What will be the output of the
statement L [3:6]?

a) [2, 3, 5]
b) [0, 1, 1]
c) [1, 2, 3]
d) None of the above

16

Saish Jaiswal | IIT Madras


Question 7
What is the output of this code?

a) 0
b) 1
c) 2
d) This code will raise a runtime error

18

Saish Jaiswal | IIT Madras


Question 8
What is the output of the following code?

Ans: 1

20

Saish Jaiswal | IIT Madras


Question 9
What is the output of the following code?

a) False True
b) True False
c) True True
d) False False
22

Saish Jaiswal | IIT Madras


Question 10
Which among the following statements is True with respect to the code given
below?

a) count=50
b) The following code throws up an error.
c) count=550
d) count=450

24

Saish Jaiswal | IIT Madras


Question 11
Find all the error(s)in the following code:

a) Index out of range


b) Syntax error
c) Variable not defined
d) 'int' object does not support item assignment

26

Saish Jaiswal | IIT Madras


Question 12
Predict the output of the following code:

L = [[1,2,3],[0,4,5],[0,0,6]]

for i in range(3):
for j in range(2,i-1,-1):
print(L[i][j], end=“”)

a) 3,2,1,5,4,6
b) 321546
c) 0,0,0,0,0,0
d) 000000

28

Saish Jaiswal | IIT Madras


Question 1
Suppose there is a movie with 3 letters, how many combinations of names are
possible?

a) 26
b) 676
c) 17576
d) 456976

Saish Jaiswal | IIT Madras


Question 2
___________ is the method to insert an item into a specified position in a list.

a) Push
b) Write
c) Insert
d) All of the above

Saish Jaiswal | IIT Madras


Question 3
Which method returns the number of occurrences of an element in a list.

a) Number of
b) Total
c) Count
d) Length

10

Saish Jaiswal | IIT Madras


Question 4
The function random.randint(1,100) in python generates.

a) A random integer between 1 to 100 with 1 and 100 both inclusive


b) A random integer between 1 to 100 with 1 and 100 both exclusive
c) A random integer between 1 to 100 with only 100 inclusive
d) None of the above

12

Saish Jaiswal | IIT Madras


Question 5
The method open(“file1.txt”, r+) opens the file file1.txt in __________________.

a) Read only mode


b) Write only mode
c) Read Write mode
d) None of the above

14

Saish Jaiswal | IIT Madras


Question 6
Consider the list L= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]. What will be the output of the
statement L [3:6]?

a) [2, 3, 5]
b) [0, 1, 1]
c) [1, 2, 3]
d) None of the above

16

Saish Jaiswal | IIT Madras


Question 7
What is the output of this code?

a) 0
b) 1
c) 2
d) This code will raise a runtime error

18

Saish Jaiswal | IIT Madras


Question 8
What is the output of the following code?

Ans: 1

20

Saish Jaiswal | IIT Madras


Question 9
What is the output of the following code?

a) False True
b) True False
c) True True
d) False False
22

Saish Jaiswal | IIT Madras


Question 10
Which among the following statements is True with respect to the code given
below?

a) count=50
b) The following code throws up an error.
c) count=550
d) count=450

24

Saish Jaiswal | IIT Madras


Question 11
Find all the error(s)in the following code:

a) Index out of range


b) Syntax error
c) Variable not defined
d) 'int' object does not support item assignment

26

Saish Jaiswal | IIT Madras


Question 12
Predict the output of the following code:

L = [[1,2,3],[0,4,5],[0,0,6]]

for i in range(3):
for j in range(2,i-1,-1):
print(L[i][j], end=“”)

a) 3,2,1,5,4,6
b) 321546
c) 0,0,0,0,0,0
d) 000000

28

Saish Jaiswal | IIT Madras


Question 1
Suppose there is a movie with 3 letters, how many combinations of names are
possible?

a) 26
b) 676
c) 17576
d) 456976

Saish Jaiswal | IIT Madras


Question 2
___________ is the method to insert an item into a specified position in a list.

a) Push
b) Write
c) Insert
d) All of the above

Saish Jaiswal | IIT Madras


Question 3
Which method returns the number of occurrences of an element in a list.

a) Number of
b) Total
c) count
d) Length

10

Saish Jaiswal | IIT Madras


Question 4
The function random.randint(1,100) in python generates.

a) A random integer between 1 to 100 with 1 and 100 both inclusive


b) A random integer between 1 to 100 with 1 and 100 both exclusive
c) A random integer between 1 to 100 with only 100 inclusive
d) None of the above

12

Saish Jaiswal | IIT Madras


Question 5
The method open(“file1.txt”, r+) opens the file file1.txt in __________________.

a) Read only mode


b) Write only mode
c) Read Write mode
d) None of the above

14

Saish Jaiswal | IIT Madras


Question 6
Consider the list L= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]. What will be the output of the
statement L [3:6]?

a) [2, 3, 5]
b) [0, 1, 1]
c) [1, 2, 3]
d) None of the above

16

Saish Jaiswal | IIT Madras


Question 7
What is the output of this code?

a) 0
b) 1
c) 2
d) This code will raise a runtime error

18

Saish Jaiswal | IIT Madras


Question 8
What is the output of the following code?

Ans: 1

20

Saish Jaiswal | IIT Madras


Question 9
What is the output of the following code?

a) False True
b) True False
c) True True
d) False False
22

Saish Jaiswal | IIT Madras


Question 10
Which among the following statements is True with respect to the code given
below?

a) count=50
b) The following code throws up an error.
c) count=550
d) count=450

24

Saish Jaiswal | IIT Madras


Question 11
Find all the error(s)in the following code:

a) Index out of range


b) Syntax error
c) Variable not defined
d) 'int' object does not support item assignment

26

Saish Jaiswal | IIT Madras


Question 12
Predict the output of the following code:

L = [[1,2,3],[0,4,5],[0,0,6]]

for i in range(3):
for j in range(2,i-1,-1):
print(L[i][j], end=“”)

a) 3,2,1,5,4,6
b) 321546
c) 0,0,0,0,0,0
d) 000000

28

Saish Jaiswal | IIT Madras


Question 13
Binary search can be applied on ___.

a) Sorted list
b) Unsorted list
c) Both A and B
d) Any list with any elements

30

Saish Jaiswal | IIT Madras


Question 14
Which of the following is a Waveform Audio File Format.

a) Wav
b) Wave
c) Wv
d) Waves

32

Saish Jaiswal | IIT Madras


Question 15
Which of the following libraries can help us to convert audio into lyrics?

a) SpeechRecognition
b) text_to_speech
c) speech_to_text
d) text_translate

34

Saish Jaiswal | IIT Madras


Question 16
State True or False: In the Monty Hall problem, swapping the choice does not
increase the chance of winning. (For the large number of experiments)

a) True
b) False

36

Saish Jaiswal | IIT Madras


Question 17
What is the correct way to initialize a dictionary?

a) D = {a-10, b-20, c-30}


b) D = {‘a’-10, ‘b’-20, ‘c’-30}
c) D = {a:10, b:20, c:30}
d) D = {‘a’:10, ‘b’:20, ‘c’:30}

38

Saish Jaiswal | IIT Madras


Question 18
What is the correct syntax to get all the keys only from a dictionary d?

a) d.key()
b) d.item()
c) d.value()
d) d.keys()

40

Saish Jaiswal | IIT Madras


Question 19
For bubble sort, which of the following statements is true?

a) If the list is sorted, the algorithm won’t work.


b) In each iteration consecutive pairs of elements are compared with each
other.
c) Every element is compared with every other element in the list in each
iteration.
d) Swapping never happens in bubble sort.

42

Saish Jaiswal | IIT Madras


Question 20
Which error is faced while accessing an element that is not there in a dictionary?

a) KeyError
b) IndexError
c) RunTimeError
d) ValueError

44

Saish Jaiswal | IIT Madras


Question 21
In dictionaries, d.items() will return ____.

a) Pairs of all (key, value) together.


b) All (keys) and (values) separately.
c) All (values) and (keys) separately.
d) Pairs of all (value, key) together.

46

Saish Jaiswal | IIT Madras


Question 1
Which of the following is true about recursion? (multiple options correct)

a) Recursion always performs better than non-recursive code.


b) Recursive code can be reused.
c) The base case is necessary for recursion.
d) Recursive code can be shorter than non-recursive code

Saish Jaiswal | IIT Madras


Question 2
If PYTHON is encoded by TCXLSR then DIAMOND will be encoded as?

a) EJBNPOE
b) FKCORPF
c) HMERTSH
d) HMEQSRH

Saish Jaiswal | IIT Madras


Question 3
Let L be a list containing different names of movies. Which statement is correct to
select a random movie name from that list L?

a) random.choices(L)
b) random.select(L)
c) random.movie(L)
d) random.random(L)

11

Saish Jaiswal | IIT Madras


Question 4
In the list L = [4,6,7,4,6,2,1], What is the index of element ‘7’?

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

13

Saish Jaiswal | IIT Madras


Question 5
What will be the output of the following code?

a) Shift every letter in a given word by value.


b) Shift every letter in a given word by 1.
c) Shift every letter in a given word by 26.
d) Returns the same word. 15

Saish Jaiswal | IIT Madras


Question 6
Values of CSV files are separated by?

a) Commas
b) Colons
c) Semi-colons
d) Slash

17

Saish Jaiswal | IIT Madras


Question 7
What will happen if we don’t check for a base case in recursion.

a) The program will run smoothly


b) The program will return a wrong output.
c) The program will enter into an infinite loop.
d) The program will never run.

19

Saish Jaiswal | IIT Madras


Question 8
Which of the following is true about recursion?

a) Recursion increases the speed of the program.


b) Recursion decreases the speed of the program.
c) Speed of the program remains the same.
d) Recursion is easier to understand than non-recursive programs.

21

Saish Jaiswal | IIT Madras


Question 1
Which of the following is/are uses of functions?

a) Gives a higher-level overview of the task to be performed


b) Reusability- uses the same functionality at various places
c) A better understanding of code
d) All of the above
e) None of the above

Saish Jaiswal | IIT Madras


Question 2
What is the output of the following spiral print python function?

a) 1 2 3 4 5 6 12 18 17 16 15 14 13 7 8 9 10 11
b) 1 2 3 4 5 6 12 18 17 16 15 14 13
c) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
d) 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

Saish Jaiswal | IIT Madras


Question 3
Which of the following library moves the turtle backward?

a) turtle.back(distance)
b) turtle.bk(distance)
c) turtle.backward(distance)
d) All of the above

11

Saish Jaiswal | IIT Madras


Question 4
Which of the following library has to be imported to plot the route map using GPS
locations in python?

a) gmplot
b) csv
c) both
d) None

13

Saish Jaiswal | IIT Madras


Question 5
In the Snakes and Ladders game, the least number of times a player has to roll a
die with the following ladder positions is _____________
ladders = { 3: 20, 6: 14, 11: 28, 15: 34, 17: 74, 22: 37, 38: 59, 49: 67, 57: 76, 61:
78, 73: 86, 81: 98, 88: 91 }

a) 4
b) 5
c) 6
d) 7

15

Saish Jaiswal | IIT Madras


Question 6
Which of the following code snippet will create a tuple in python?

a) name = (‘kiran’, ‘bhushan’, ‘madan’)


b) name = {‘kiran’, ‘bhushan’, ‘madan’}
c) name = [‘kiran’, ‘bhushan’, ‘madan’]
d) None of the above

17

Saish Jaiswal | IIT Madras


Question 7
What does the following program plot?

a) Plots the random number generated in each iteration


b) Plots the number of times the given input matches with the random number
generated 19

c) Plots the input entered for each iteration


d) none of the above Saish Jaiswal | IIT Madras
Question 1
Strings in python can be created using

a) single quotes
b) double quotes
c) triple quotes
d) only A and B
e) A, B and C

Saish Jaiswal | IIT Madras


Question 2
Which of the following is not true about tuples in python?

a) Tuple consumes less memory


b) Tuples are immutable
c) Tuple supports item deletion
d) Tuples does not support modification

Saish Jaiswal | IIT Madras


Question 3
What is the output of the following code snippet in python?
name =(‘kiran’, ‘bhushan’, ‘madan’)
print (name[-1])

a) invalid syntax
b) tuple index out of range
c) prints nothing
d) madan

11

Saish Jaiswal | IIT Madras


Question 4
What is NLTK primarily used for?

a) Web scraping
b) Machine learning
c) Natural language processing
d) Image processing

13

Saish Jaiswal | IIT Madras


Question 5
Which of the following is true about NLTK's tokenization?

a) NLTK only supports sentence-level tokenization


b) Tokenization is the process of splitting text into words or phrases
c) NLTK does not support tokenization
d) Tokenization is the process of converting text to lowercase

15

Saish Jaiswal | IIT Madras


Question 6
What is the output of the following code?

a) ['Have nice day, my friend!!! Programming in Python is fun']


b) ['Have nice day, my friend!!!', 'Programming in Python is fun']
c) 'Have nice day, my friend!!!'
'Programming in Python is fun'
d) Error

17

Saish Jaiswal | IIT Madras


Question 7
Which NLTK module provides functionality for stemming words?

a) nltk.corpus
b) nltk.sentiment
c) nltk.tokenize
d) nltk.stem

19

Saish Jaiswal | IIT Madras


Question 8
What is the purpose of NLTK's 'corpus' module?

a) To perform part-of-speech tagging


b) To tokenize text
c) To access and work with large collections of text data
d) To perform sentiment analysis

21

Saish Jaiswal | IIT Madras


Question 9
Which NLTK method can be used for removing stop words from a text?

a) nltk.sentiment
b) nltk.remove_stopwords
c) nltk.corpus.stopwords
d) nltk.tokenize

23

Saish Jaiswal | IIT Madras


Question 10
What is the NLTK function used for finding synonyms and antonyms of words?

a) nltk.stem
b) nltk.wordnet
c) nltk.tokenize
d) nltk.corpus

25

Saish Jaiswal | IIT Madras


Question 11
NLTK provides a way to perform Named Entity Recognition (NER). Which method is
used for this purpose?

a) nltk.sentiment
b) nltk.parse
c) nltk.chunk
d) nltk.ner

27

Saish Jaiswal | IIT Madras


Question 12
Which NLTK module is used for part-of-speech tagging?

a) nltk.corpus
b) nltk.tokenize
c) nltk.sentiment
d) nltk.pos_tag

29

Saish Jaiswal | IIT Madras


Question 13
In NLTK, what is the purpose of the 'FreqDist' class?

a) To calculate the frequency distribution of words in a text


b) To perform sentiment analysis
c) To tokenize text
d) To perform stemming

31

Saish Jaiswal | IIT Madras


Question 14
What is the primary purpose of the Python Imaging Library (PIL) or Pillow library?

a) Handling audio files


b) Working with image files
c) Parsing XML documents
d) Creating 3D graphics

33

Saish Jaiswal | IIT Madras


Question 15
Which of the following is a commonly used data structure in PIL for representing
images?

a) List
b) Tuple
c) Dictionary
d) NumPy array

35

Saish Jaiswal | IIT Madras


Question 16
Which module in the Pillow library is used for opening and manipulating image
files?

a) pillow.open
b) pillow.process
c) pillow.image
d) PIL

37

Saish Jaiswal | IIT Madras


Question 17
Which Pillow method is used to resize an image to a specified size?

a) resize()
b) scale()
c) change_size()
d) reshape()

39

Saish Jaiswal | IIT Madras


Question 18
What does the Image.open() method in Pillow return?

a) A new blank image


b) An error message
c) An image object
d) A list of image filenames

41

Saish Jaiswal | IIT Madras


Question 19
Which format is commonly used for saving lossless, high-quality images in Pillow?

a) JPEG
b) PNG
c) GIF
d) BMP

43

Saish Jaiswal | IIT Madras


Question 20
Which of the following method will return the RBG value of a pixel in python?

a) getpixel()
b) RBGvalue()
c) pixelValue()
d) none of the above

45

Saish Jaiswal | IIT Madras


Question 21
Which method is used to convert an image to grayscale in Pillow?

a) grayscale()
b) convert_to_grayscale()
c) convert()
d) filter()

47

Saish Jaiswal | IIT Madras


Question 1
Which of the following is not true about Stylometry Analysis?

a) It is the quantitative study of literature style


b) It is based on the observation that the authors tend to write in relatively
consistent and recognizable ways
c) any two people may have the same vocabulary
d) It is a tool to study a variety of questions involving style of writing

Saish Jaiswal | IIT Madras


Question …
How can we identify which book is written by which author?

a) By matching handwriting.
b) By analyzing word length distribution with previous books.
c) By analyzing the number of pages in a book.
d) By analyzing the book’s preface.

10

Saish Jaiswal | IIT Madras


Question …
Networkx in python is used for which of the following operation(s)?

a) Visualizing social network


b) Analyzing social networks
c) Generate social network
d) All of the above
e) None of the above

12

Saish Jaiswal | IIT Madras


Question …
Which of the following will generate a complete graph in python using the
networkx package?

a) Graph = nx.gnp_random_graph(25,0.5)
b) Graph = nx.gnp_random_graph(25,1.0)
c) Graph = nx.gnp_random_graph(25,0.25)
d) Graph = nx.gnp_random_graph(25,0.75)

14

Saish Jaiswal | IIT Madras


Question …
Which of the following is true about six degrees of separation?

a) the minimum degree of separation of any node in the network is 6


b) the maximum degree of separation of any node in the network is 6
c) the average degree of separation of the nodes in the network is 6
d) the degree of separation of every node in the network is 6

16

Saish Jaiswal | IIT Madras


Question …
Is it guaranteed that the following code snippet will consistently yield a True
result?

a) True
b) False
c) It will return neither True nor False
d) It will throw an error

18

Saish Jaiswal | IIT Madras


Question …
How many neighbors does node 4 have?

a) 1
b) 2
c) 3
d) 4
20

Saish Jaiswal | IIT Madras


Question …
Degree of separation is equivalent to

a) Number of nodes in a graph


b) Number of edges in a graph
c) The average length of the shortest path in a graph
d) None of the above

22

Saish Jaiswal | IIT Madras


Question …
Assuming that the length and breadth remain constant, how can we enhance the
precision of the calculated area for a state?

a) By increasing the size of the image.


b) By increasing the number of points.
c) By decreasing the size of the image.
d) By decreasing the number of points.

24

Saish Jaiswal | IIT Madras


Question …
While calculating the area of Punjab, which of the following will help in more
accurate results.

a) More points landed in the Punjab region.


b) More points landed outside the Punjab.
c) More points on the overall map.
d) None of the above.

26

Saish Jaiswal | IIT Madras


Question …
Which module in Python provides constants and functions for working with strings?

a. str
b. string
c. text
d. textutils

Saish Jaiswal | IIT Madras


Question …
What does string.ascii_letters contain?

a. Uppercase letters only


b. Lowercase letters only
c. Both uppercase and lowercase letters
d. Numerical digits

10

Saish Jaiswal | IIT Madras


Question …
Which function from the string module capitalizes the first letter of each word in
a string?

a. capitalize()
b. title()
c. upper()
d. capwords()

12

Saish Jaiswal | IIT Madras


Question …
How can you check if a string contains only lowercase letters using the string
module?

a. islower()
b. isalpha()
c. isdigit()
d. islowercase()

14

Saish Jaiswal | IIT Madras


Question …
Which of the following is used for generating random passwords with the string
module?

a. string.random_password()
b. random.choice(string.ascii_letters)
c. random_password(string.ascii_letters)
d. string.generate_password()

16

Saish Jaiswal | IIT Madras


Question …
What is the purpose of the string.punctuation constant?

a. It contains punctuation characters.


b. It contains only letters.
c. It contains only numbers.
d. It contains both uppercase and lowercase letters.

18

Saish Jaiswal | IIT Madras


Question …
Which function is used for formatting strings with placeholders in the string
module?

a. string.format()
b. string.replace()
c. string.Template()
d. string.substitute()

20

Saish Jaiswal | IIT Madras


Question …
What is the output of the following code?

import string s = "Hello, World!"


result = s.strip(string.punctuation)
print(result)

a. "Hello, World!"
b. "Hello World"
c. "Hello"
d. "World"

22

Saish Jaiswal | IIT Madras


Question …
Which math problem flames is related to?

a) Kadane's problem
b) Josephus problem
c) Conjecture Collatz
d) Dijkstra Problem

24

Saish Jaiswal | IIT Madras


Question …
What is Selenium primarily used for in Python?

a. Web scraping
b. Web testing and automation
c. Data analysis
d. File manipulation

Saish Jaiswal | IIT Madras


Question …
Which method in Selenium is used to locate and interact with web elements by
their HTML tag name?

a. find_element_by_tag_name()
b. find_element_by_id()
c. find_element_by_class_name()
d. find_element_by_name()

11

Saish Jaiswal | IIT Madras


Question …
What is the purpose of the WebDriver in Selenium?

a. To parse HTML documents


b. To automate web browsers
c. To create GUI applications
d. To generate random data

13

Saish Jaiswal | IIT Madras


Question …
To simulate a click action on a web element using Selenium in Python, which
method should you use?

a. click_element()
b. simulate_click()
c. click()
d. interact()

15

Saish Jaiswal | IIT Madras


Question …
Which command is used to close the current browser window or tab in Selenium
WebDriver?

a. driver.quit()
b. driver.close()
c. driver.exit()
d. driver.stop()

17

Saish Jaiswal | IIT Madras


Question …
In Selenium, what does the "driver.get()" method do?

a. It closes the current browser window.


b. It opens a new browser window.
c. It navigates to a specified URL.
d. It retrieves the HTML source code of the current page.

20

Saish Jaiswal | IIT Madras


Question …
What does the datetime library in Python primarily deal with?

a. Mathematical calculations
b. Date and time manipulation
c. File input and output
d. Network communications

22

Saish Jaiswal | IIT Madras


Question …
Which of the following classes is used to represent a date and time in the
datetime module?

a. date
b. time
c. datetime
d. timestamp

24

Saish Jaiswal | IIT Madras


Question …
How can you create a datetime object representing the current date and time?

a. datetime.now()
b. datetime.today()
c. datetime.current()
d. datetime.current_time()

26

Saish Jaiswal | IIT Madras


Question …
What is the primary purpose of the pytz library in Python?

a. Generating random numbers


b. Working with time zones
c. Parsing JSON data
d. Handling regular expressions

28

Saish Jaiswal | IIT Madras


Question …
Which function from the pytz library is used to set the time zone for a datetime
object?

a. set_timezone()
b. convert_timezone()
c. localize()
d. timezone()

30

Saish Jaiswal | IIT Madras


Question …
What is the calendar library in Python primarily used for?

a. Mathematical calculations
b. Date and time manipulation
c. Working with graphical user interfaces (GUIs)
d. Creating and formatting calendars

32

Saish Jaiswal | IIT Madras


Question …
In the calendar module, how do you find the number of days in a specific month
of a year?

a. calendar.monthrange(year, month)
b. calendar.month_days(year, month)
c. calendar.days(month, year)
d. calendar.get_month_days(year, month)

34

Saish Jaiswal | IIT Madras


Question …
What is the PageRank algorithm used for?

a. Text summarization
b. Document retrieval
c. Web page ranking
d. Image recognition

Saish Jaiswal | IIT Madras


Question …
Which of the following factors does PageRank consider in ranking web pages?

a. Page load time


b. Font size and type
c. Keyword density
d. Inbound link quality and quantity

10

Saish Jaiswal | IIT Madras


Question …
In the context of PageRank, what is a "damping factor"?

a. A factor that determines the age of a web page


b. A factor used to penalize overly long documents
c. A factor that represents the likelihood of a user clicking on a link
d. A factor that measures the speed of a web server

12

Saish Jaiswal | IIT Madras


Question …
In the Collatz conjecture, for a positive integer n, if n is even, what operation is
applied to n?

a. n / 2
b. n - 1
c. 2n
d. 3n + 1

14

Saish Jaiswal | IIT Madras


Question …
What is the ultimate goal of the Collatz conjecture?

a. To find prime numbers


b. To reach the number 1
c. To generate a sequence of Fibonacci numbers
d. To find the largest integer

16

Saish Jaiswal | IIT Madras

You might also like