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

The Joy of Computing Using Python JAN-2025

The document contains a series of assignments related to Python programming, covering various topics such as loops, data types, functions, and magic squares. Each week presents a set of questions designed to test knowledge and understanding of programming concepts. The assignments include multiple-choice questions and programming tasks for practical application.

Uploaded by

sahootanish2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

The Joy of Computing Using Python JAN-2025

The document contains a series of assignments related to Python programming, covering various topics such as loops, data types, functions, and magic squares. Each week presents a set of questions designed to test knowledge and understanding of programming concepts. The assignments include multiple-choice questions and programming tasks for practical application.

Uploaded by

sahootanish2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

The Joy of Computing Using Python

JAN-2025 Assignment
​ ​ ​
Week 1 Assignment
Q1. Which blocks can be used to move the cat?

A) Walk
B) Move
C) Teleport
D) Glide

2. Which set of blocks moves the cat 40 steps and then points down?

3. What does the cat say here?


A) Says the number 7, for 1 second, 7 times, and changes the value of the variable by multiplying
the previous value with 1.
B) Says the number 7, for 1 second, 7 times, and changes the value of the variable by adding 1.
C) Says the number 7, for 1 second, then numbers from 6 to 1, one by one, for 1 second each.
D) Says the number 7, for 1 second, then numbers from 6 to 0, one by one, for 1 second each.

4. From the previous question, what is the value of myNum after the loop ends?

A) 1
B) 2
C) 7
D) 0

5. Let the answer from the previous question be stored in variable x. What does the cat say after the
execution of the loop?

A) 16
B) 5
C) 29
D) 2

6. Which of the following data types is primarily used for storing a sequence of characters in most
programming languages?

A) Integer
B) Float
C) String
D) Boolean
7. Which of the following statements best describes why loops are commonly used?

A) Loops make the code run slower but more reliably.


B) Loops allow you to execute a block of code repeatedly without having to write it multiple times.
C) Loops are only useful for error handling.
D) Loops automatically convert variables from one data type to another.

8. Suppose you have an arithmetic expression involving addition, subtraction, multiplication, and
exponentiation. Which statement is true about instructing a computer to evaluate it?

A) Such expressions cannot be computed.


B) A computer can only evaluate expressions involving addition and multiplication.
C) These expressions can be evaluated using built-in operations or libraries.
D) A computer can only evaluate expressions involving addition and subtraction.

10. What task does the block below accomplish?

A) Moves the ball in a parabolic path and stops 18 steps away from the center (0, 0) in the x-direction.
B) Moves the ball in a circular path 18 times.
C) Moves the ball in a parabolic path and stops 18 steps away from the center (0, 0) in the y-direction.

D) Moves the ball in a parabolic path and stops 17 steps away from the center (0, 0) in the x-direction.
Week 2 Assignment
Q1. Statement: If a variable is assigned a value once, the value in the variable cannot be changed in the
variable.

a. False, the variable stores all values it was assigned.


b. False, the variable stores the value from the latest assignment.
c. True, the variable stores only the value from the second-last assignment.
d. True, the variable stores value from the initial assignment only.

Q2. Which of the following code blocks prints – “Ramesh talks to Suresh and Kamlesh”?

a. print(j'Ramesh talks to Suresh and Kamlesh" + and")


b. print("Ramesh talks to " "Suresh" " Kamlesh")
c. print("Ramesh talks to Suresh" " and " " Kamlesh ")
d. print("Ramesh talks to" "Suresh and Kamlesh")

Q3. What aren’t the correct ways to inform Python that input is a decimal point number?

a. in(input())
b. float(input())
c. int(input())

d.a = input()
a = int(a)

Q4. The following program outputs 723.


def mystery(container):
result = []
for i in range(len(container)):
result.append(i)
else:
result.append(len(container))
return result

For what value of a does the code output 123?

a. 1
b. 2
c. 6
d. 5

Q5. What does the previous question calculate?

a. Calculates the factorial of a.


b. Calculates the factorial of a-1 and adds 3.
c. Calculates the factorial of a-1+3.
d. Calculates a multiples of a starting from 1 and adds 3.
Q6. Which loop is used to perform a set of repetitive tasks without a condition by default in Python?

a. while loop
b. for loop
c. do-while loop
d. while-range loop

Q7. What happens when the condition inside the if and while evaluate to false?

a. Python interpreter ignores the if/while blocks and halts the program.
b. Python interpreter ignores the if/while blocks and proceeds with the program from the lines after
the if/while block.
c. Python interpreter executes the if/while blocks and the rest of the program.
d. Python interpreter executes the if/while blocks, and the program runs in an infinite loop.

Q8. The following program might/might not have an infinite loop. Does the program have an infinite loop?

a. No, the program doesn’t have an infinite loop.


b. Yes, it can be prevented by updating the value of a before the if block at line 3.
c. Yes, it can be prevented by removing both the if blocks inside the while loop.
d. Yes, but it cannot be prevented.
Q9. For which of the following values of name and age variables does the following code print ‘You are
lucky’?

a. aryan, 20
b. arjun, 19
c. aakash, 16
d. anand, 18

Q10. For which of the options from the previous question does the program not print anything?

a. aryan, 20
b. aakash, 16
c. arjun, 19
d. anand, 18
Week 3 Assignment
1) Which of the following is/are false statement(s)?

a) Lists are fixed in size; they cannot store more than 1024 values.
b) One can access elements in a list using non-numeric indices.
c) Iterating over lists is possible in Python.
d) We need to specify the required size of a list while creating a new list variable.

2) In the below code:

For what value of n does the program print 10?

ANS- 5

3) From the previous question, for what values of nn is the number 25 appended to list a?

a) 25
b) 24
c) 35
d) 32
4) What does the following code perform?

a) It converts any input list into a new list which is filled with some numbers that are always in
increasing order.
b) It converts any input list into a new list such that at even indices, the value is a multiple of an
even number and at odd indices, the value is either even or a negative number.
c) It converts any input list into a new list such that at odd indices, the value is always an even
number and at even indices, the value is negative.
d) It converts any input list into a new list, which follows no pattern.

5) From the previous question, if the option:

“It converts any input list into a new list such that at even indices, the value is a multiple of an even number
and at odd indices, the value is either even or a negative number.”

is incorrect, can you make changes to the code so that this option is always true for any input?

a) No, it is not possible to make such changes.


b) No, the option is already correct.
c) Yes, we can make changes.

6) If file.txt exists, does the following code successfully run?

with open("file.txt", "r") as f:


data = f.read()
print(data)

a) Yes
b) No

7) Which of the following are examples of Social Computing?

a) ChatGPT
b) Wikipedia
c) Quora
d) Twitch
8) What does the following code print for n=2560n = 2560?

a) PYTHON IS BORING
b) PYTHON IS FUN

9) From the previous question, is a.sort() responsible for printing either of the two possible sentences?

a) Yes, and the code may print “PYTHON IS FUN”.


b) No, it is purely dependent on variable nn.
c) No, it is not dependent on a.sort(), and the code will never print “PYTHON IS FUN”.

10) What does the code in question 8 calculate?

Can you determine the values of k and b


if: n=245326785456×103359n = 245326785456 \times 103359

If the values of kk and bb are different, enter 0; else, enter the value of kk.

Ans - 57
Week 4 Assignment
Q1. Which of the following options provides the general formula for the magic constant of a magic square
of size n, where all elements are distinct numbers from 1 to n²?

a) n(n² + 1) / 2
b) n³ / 2
c) n³ + 2n²
d) (n⁴ + n²) / 2n

Q2. What would the magic constant be for a magic square of size 7, given that all elements in the square
are distinct numbers from 1 to 49?

a) 260
b) 111
c) 175
d) 165

Q3. Does transposing any magic square change the sum across some rows/columns/diagonal?

a) Yes
b) No

Q4. Which of the following are valid magic squares?

Ans - a, c, d
Q5. What is the minimum number of people required to ensure that at least three of them share the same
30-minute birth interval? The intervals start from 12:00 AM, and each interval lasts for half an hour.

Ans. 97

Q6. Calculate the magic constant for a 5×5 square, where all elements are distinct numbers from 1 to 25.
Is it the same as the magic constant for Ramanujan’s magic square?

If yes, enter 0, else enter the absolute difference between the two.
Hint: Search about Ramanujan’s magic square.

Ans. 74

Q7. What task does mystery1() perform?

a) Calculate factorial of number n.


b) Calculate factors of number n.
c) Calculate factors of number n+1 excluding n.
d) Calculate factors of number n excluding n.

Q8. For what n1, n2 will the variable flag inside mystery2() be equal to True?

a) 1,2
b) 2,3
c) 3,4
d) 0,0
Q9. If all possible pairs of prime numbers between 0 and 10 are given to n1 and n2, for how many pairs
would mystery2() print “Completed”?

a) It will print “Completed” only for pairs (2,3), (7,2), (2,5), and for the remaining it would not print
“Completed”.
b) It will print “Completed” only for pair (2,3), and for the remaining other pairs of primes, it would not
print “Completed”.
c) It will print “Completed” for all pairs of primes between 0 and 20.
d) It will not print “Completed” for any pair.

Q10. If the number of pairs of primes that result in mystery2() printing “Completed” is lesser than 1, can we
edit the code in mystery2() so that “Completed” is always printed for any pair of primes?

a) Yes, we can change the logic for setting the flag variable to False.
b) No, it is logically not possible.
c) Yes, we can change/decrease the threshold for the length of list2 in the last if block.
d) Yes, we can change the initial value of flag to False instead of True.
Week 5 Assignment
Q1. Which of the following is the correct way to add data with key as CS102 and value as “Database
Management Systems” to a dictionary named courses?

a) courses["CS101"] = ("Database Management Systems")


b) courses["CS102"]["Database Management Systems"]
c) courses["CS102"] = "Database Management Systems"
d) courses["CS101"] = "Database Management Systems"

Q2. What is the probability of Monty not opening the door with a goat, given the hypothesis that you initially
chose the door which has a car?

a) 0
b) 0.5
c) 1
d) 0.33

Q3. What should be replaced with ? in line 10, so that there is a high chance that final_choice is equal to
2?

a) 2
b) 2**(1024) % 2 != 0
c) 2*(2**(89) + 7) % 2 == 0
d) (2**(90)) % len(doors) != 1

Q4. Given that you have a sorted list of 2048 elements, what is the maximum number of comparisons to
search such an element using linear search? Can binary search do it in fewer comparisons?

a) Yes, binary search can do it more efficiently, linear search takes 1024 comparisons
b) Yes, binary search can do it more efficiently, linear search takes 2048 comparisons
c) No, binary search may/may not do it more efficiently, linear search takes 1024 comparisons
d) No, binary search will take more comparisons, linear search takes 2048 comparisons
Q5. What is the primary use of a file with a .wav or .wave extension?

a) Storing video recordings


b) Storing log files
c) Storing waves of files
d) Storing audio recordings

Q6. What does this program print in the end?

a) Fraction of throws where both players showed different symbols (rock/paper/scissors)


b) Fraction of throws where both players showed rock
c) Fraction of throws where both players showed the same symbol (rock/paper/scissors)
d) Fraction of throws where both players showed paper

Q7. In binary search, the list gets divided in every iteration to find the element.

a) True
b) False

Q8. Which of the following are requirements for binary search to work correctly?

a) The list can be unsorted.


b) The list must contain only positive integers.
c) The list must be sorted.
d) The list must have no duplicate values.

Q9. Given an array [4, 2, 7, 1, 3], what will be the array after the third pass of Bubble Sort?

a) [1,3,2,4,7]
b) [2,4,1,3,7]
c) [1,2,3,4,7]
d) [2,1,3,4,7]

Q10. How many swaps are performed in iteration 3 for bubble sorting the list [5,4,3,2,1]? Enter 0 if the list
is sorted in less than 3 iterations.

Ans - 2
Week 6 Assignment
Que. 1 If nn is a positive integer, what is the output of the function given input nn?

def mystery(n):
if n <= 0:
return 0
return n + mystery(n - 1)

a) Sum of numbers from 1 to n


b) Sum of numbers from 1 to n−1n-1
c) n−1n-1
d) nn

Que. 2 Assertion (A): If a recursive function doesn’t have a base case, it may never stop.
Reason (R): Recursion means that a function calls itself.

a) Both (A) and (R) are true, and (R) is the correct explanation of (A).
b) Both (A) and (R) are true, but (R) is not the correct explanation of (A).
c) (A) is true, but (R) is false.
d) (A) is false, but (R) is true.

Que. 3 What is the output of the following code?

a) Error
b) 25
c) 26
d) 5
Que. 4 In English, the letter ‘z’ usually appears far less often than most letters. Now imagine applying a
Substitution Cipher to a large body of English text, where ‘z’ is replaced by ‘r’, and every other letter is also
mapped to a unique letter. After encryption, which letter is likely to be the least frequent in the new text?

a) z
b) r
c) e
d) It is not possible to determine

Que. 5 If you have a large ciphertext produced by a simple substitution cipher on an English text, can you
determine the original message by examining how often each letter appears?

a) Yes, it can be done.


b) No, it cannot be done.

Que. 6 Suppose you suspect that a piece of ciphertext was produced using a simple substitution cipher.
Under which circumstances might frequency analysis fail to yield accurate results?

a) The ciphertext is short.


b) The ciphertext was encrypted with another method before encrypting with substitution cipher.
c) The ciphertext is very long.

Que. 7 If variable dict_name is a non-empty dictionary, what does dict_name.values() return?

a) Returns nothing, but prints all the keys in the dictionary.


b) Returns a list of all the keys in the dictionary.
c) Returns a list of all the values in the dictionary.
d) Returns a list of all the items in the dictionary.

Que. 8 Assertion (A): A Caesar Cipher is a type of Substitution Cipher.


Reason (R): In a Caesar Cipher, each letter in the plaintext is replaced by a letter at a fixed shift in the
alphabet.

a) Both (A) and (R) are true, and (R) is the correct explanation of (A).
b) Both (A) and (R) are true, but (R) is not the correct explanation of (A).
c) (A) is true, but (R) is false.
d) (A) is false, but (R) is true.

Que. 9 Which outcome generally follows from providing a proper base case in a recursive function?

a) The function returns a predefined result when the base condition is met.
b) It prevents infinite recursion and stops when a specific condition is met.
c) It ensures recursion depth is always constant.
d) It allows the function to keep calling itself indefinitely
Que. 10 In a standard 3×3 Tic-Tac-Toe board, how many distinct winning lines (rows, columns, or
diagonals) pass through the center square?

a) 3
b) 2
c) 5
d) 4
Week 7 Assignment
Q1. What will be the output of the following code?

a) 2
b) 3
c) 4
d) Error

Q2. What is the spiral order traversal of the given matrix?

a) 1, 2, 3, 7, 11, 10, 9, 5, 6
b) 1, 2, 3, 5, 6, 7, 9, 10, 11
c) 1, 5, 9, 10, 11, 7, 3, 2, 6
d) 1, 5, 9, 2, 6, 10, 3, 7, 11
Q3. What type of triangle is drawn by the given code?

a) Scalar triangle
b) Right angle triangle
c) Equilateral triangle
d) Isosceles triangle

Q4. Which of the following programs will draw a hexagon?

​ ​ Ans. b
Q5. What will be the output of the following code?

a) {1: “one”, 1.0: “float one”, True: “boolean one”}


b) {1: “boolean one”}
c) {1: “one”, 1.0: “float one”}
d) {1.0: “float one”, True: “boolean one”}

Q6. What is the output of the following code?

​ ​ Ans . d
Q7. Which turtle command is equivalent to lifting up a pen?

a) penlift()
b) penup()
c) uppen()
d) penremove()

Q8. Why do we use functions?

a) To improve readability.
b) To reuse code blocks.
c) For the ease of code debugging.
d) All of the above.

Q9. Which library is used to import images?

a) PIL
b) Imageview
c) IMG
d) image

Q10. In Snakes and Ladders, what can be the ways to track ladders and snakes?

a) Maintain a dictionary with snake or ladder number blocks as keys.


b) Using the if condition to check on every number.
c) Both A and B.
d) Both A and B.
Week 8 Assignment
1) What will be the output of the following Python code?

tup = ([1, 2, 5], [3, 4])


tup[0].append(5)
print(tup)

a) ([1, 2, 5], [3, 4])


b) ([1, 2], [3, 4])
c) ([1, 2], [3, 4, 5])
d) TypeError: Tuple object does not support item assignment

2) What operations can be performed on tuples?

a) Tuples are appendable


b) We can delete a value from tuples
c) Both (a) and (b)
d) We can count the number of instances of an element

3) What will be the output of the following Python code?

a) 1, 2, 3, 4, 5
b) 5, 4, 3, 2, 1
c) 5, 4, 3, 2
d) 1, 2, 3, 4

4) What will be the output of the following Python code?


a) facebook
b) gbdfcppl
c) ezbdannj
d) ytvxuhhd

5) When will the program print “Clap”?

a) When both players enter the same letters.


b) When player 2 enters the next letter after player 1.
c) When player 1 enters the next letter after player 2.
d) It will never clap.

6) What will be the effect of the following Python code on the graph?

a) The graph will go up when guess and pick are the same.
b) The graph will go down when guess and pick are the same.
c) The graph will go up when guess and pick are not the same.
d) Both (b) and (c)
7) What is the primary advantage of using tokenization in Natural Language Processing (NLP)?

a) It allows the model to understand entire sentences as a single entity.


b) It splits text into smaller, manageable units, which helps in processing language more effectively.
c) It eliminates the need for syntactical analysis.
d) It improves the grammatical structure of the text.

8) What will be the output of the following Python code?

string = 'hey!there'
a = sorted(string)
a.reverse()
print(a)

a) [‘!’, ‘e’, ‘e’, ‘e’, ‘h’, ‘h’, ‘r’, ‘t’, ‘y’]


b) [‘h’, ‘e’, ‘y’, ‘!’, ‘t’, ‘h’, ‘e’, ‘r’, ‘e’]
c) [‘y’, ‘t’, ‘r’, ‘h’, ‘h’, ‘e’, ‘e’, ‘e’, ‘!’]
d) None of the above

9) While converting an image into black and white, can it be converted back into a colored image?

a) True
b) False

10) What will be the output of the following Python code?

a) Converting lowercase letters into uppercase


b) Converting uppercase letters into lowercase
c) Returns the same word.
d) Error.
Week 9 Assignment
1. How can we identify which book is written by which author?

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

2. What is the key difference between lists and tuples in Python, and when would you choose one over the
other?

a. Lists are immutable and can be used when elements need to be modified, while tuples are
mutable and best for storing fixed data.
b. Lists are mutable and can be used for dynamic data manipulation, while tuples are immutable
and used to store fixed collections of items.
c. Both lists and tuples are mutable and can be used interchangeably for any purpose.
d. Tuples are used only for string data, while lists can store any data type.

3. Will the following piece of code always return True?

a. True
b. False

4. What is the output of the following code?


​ ​ Ans - d
5. What is the total degree of the given graph?

a. 10
b. 8
c. 6
d. 4​

6. Which of the following is always true for a connected undirected graph with at least one edge?

a. Every node has an even degree


b. The sum of all node degrees is even
c. The graph contains an Eulerian path
d. The graph contains a Hamiltonian cycle

7. What is the primary difference between using single quotes, double quotes, and triple quotes to create
strings in Python?

a. Single and double quotes can only be used for single-line strings, while triple quotes are used for
multi-line strings
b. Single quotes are used for strings with one word, while double quotes are for strings with multiple
words
c. Double quotes are more efficient than single quotes for creating strings
d. There is no difference in how Python interprets single quotes, double quotes, or triple quotes for
strings

8. How many nodes and edges does the following graph have?

a. 10,6
b. 10,5
c. 8,6
d. 8,5
9. A complete graph will have a degree of separation?

a. 1
b. 2
c. 3
d. Depends on the number of nodes

10. What will be the output of the following code?

a. It will print “Hello”


b. It will raise a TypeError
c. The string will be updated to “Hello”
d. It will change the first character to uppercase and print “Hello”
Week 10 Assignment
1. Which of the following statements is correct about Python’s dynamic typing?

a) Variables must be declared before use.


b) A variable’s type can change at runtime.
c) Python does not allow reassignment of variable types.
d) Python is statically typed.

2. What will be the output of the following code?

a) toPmiagmnrh
b) toPmiagmnrPg
c) tnoaigmooP
d) toPmiagmnr

3. What does the following code print?

a) 6
b) 7
c) 9
d) Value Error

4. Which statement about find() and index() in Python is true?

a) Both return -1 if the substring is not found.


b) index() raises an error if not found, but find() returns -1.
c) index() and find() behave identically.
d) Both return the first index of occurrence.

5. What will be the output of the following Python code?

print(17 % -5)

a) 3
b) 2
c) 0
d) -3
6. Which method in PIL is used to resize an image while maintaining the aspect ratio?

a) resize()
b) thumbnail()
c) reshape()
d) aspect ratio resize()

7. Which of the following correctly finds all numbers divisible by 3 but not by 5 in a list?

nums = range(1, 50)

a) [x for x in nums if x % 3 == 0 and x % 5 != 0]


b) [x for x in nums if x % 5 != 0 or x % 3 == 0]
c) [x for x in nums if x % 3 != 0 and x % 5 == 0]
d) filter(lambda x: x % 3 == 0 and x % 5 == 0, nums)

8. What will be the output of the following code?

a) 2
b) 5
c) [5, 6]
d) 4

9. For which value of axis the output is [5, 7, 9] in the below code?

a) 0
b) 1
c) 2
d) axis argument is not required.
10. What will be the shape of the resulting NumPy array?

a) (3, 2)
b) (4, 3)
c) (3, 4)
d) (4, 2)
Week 11 Assignment
Q1. In Selenium, what is the purpose of WebDriver, such as webdriver.Chrome()?

It is used to interact with web elements like buttons and text fields.
It launches and controls a web browser session for automation.
It is used to write test cases in Selenium.
It provides built-in methods to handle databases in web applications.

Q2. Which of the following is the best locator strategy in Selenium in terms of performance?

find_element_by_name()
find_element_by_id()
find_element_by_class_name()
find_element_by_xpath()

Q3. Selenium WebDriver can be used to automate both web and native mobile applications on Android
and iOS.

True
False

Q4. What is the output of the following Python code?

(0, 0) (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) (4, 0) (4, 1)


(0, 0) (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) (3, 0) (3, 1) (4, 0) (4, 1)
(0, 0) (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) (3, 0) (3, 1) (3, 2) (4, 0) (4, 1)
(0, 0) (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) (3, 0) (4, 0) (4, 1) (4, 2)
Q5. What will be the output of the following Python code, which performs a modified linear search?

Checking 3
Checking 8
Checking 1
Found at index 3

Checking 3
Checking 1
Found at index 3

Checking 3
Checking 8
Checking 1
Checking 7
Found at index 3

Found at index 3

Q6. What does calendar.isleap(2100) return?

False
True
None
1

Q7. What is the output of datetime.date(2024, 2, 29) + datetime.timedelta(days=1)?

2024-02-30
2024-03-01
ValueError
2024-02-29

Q8. Which function is used to get the current local time in Python?

time.localtime()
datetime.now()
time.time()
datetime.utcnow()

Q9. What happens when you apply .astimezone() to a naive datetime object?

It changes to UTC
It raises an error
It assumes local timezone
It converts to IST
Q10. What is the output of the following Python code?

2024-02-29 12:00:00 IST


2024-02-29 06:30:00 UTC
2024-02-29 12:00:00 UTC
Error
Week 12 Assignment
Q2. In networkX, which function is used to return the degree of a specific node?

G.degree(node)
G.get_degree(node)
G.node_degree(node)
G.find_degree(node)

Q3. Observe the following graph generated using the networkx module. How many edges does this graph
contain?

6
7
8
9

Q4. What does nx.cycle graph(4) generate?

A directed cycle of 4 nodes


A cycle graph with 4 nodes connected in a closed loop
A ladder graph with 4 rounds in the ladder
A complete graph with 4 nodes
Q5. Observe the following graph generated using the networkx module. What type of graph is this?

Ladder Graph
Barbell Graph
Wheel Graph
Star Graph

Q6. What will be the output of the following code?

(4, 4)
(4, 8)
(4, 2)
(8, 4)
Q7. What is the output of this code?

7
16
5
10

Q8. What will be the first 10 numbers generated starting from n = 7?

[7, 36, 18, 9, 46, 23, 116, 58, 29, 146]


[7, 36, 18, 9, 28, 14, 7, 36, 18, 9]
[7, 20, 10, 5, 26, 13, 66, 33, 166, 83]
[7, 31, 15, 7, 36, 18, 9, 46, 23, 116]
Q9. Which technique is used in the PageRank algorithm to determine the rank of a web page?

Depth-First Search
Hyperlink Analysis
Random Walk Simulation
Data Scraping

Q10. In the PageRank algorithm, what happens when a page receives multiple inbound links from highly
ranked pages?

Its rank decreases due to increased server load


Its rank improves
Its rank remains the same
It is considered less relevant

You might also like