# The Joy of Computing using Python | NPTEL 2023 | Week 6 Assignment Solutions This set of MCQ(multiple choice questions) focuses on the The Joy of Computing using Python Week 6 Solutions.

The course carries programming to your work area with stories, similarities and distinguished models. Going reflections to experiences and designing to engineering, the course concentrates fundamentally to rouse the student’s psyche to automatically think intelligently and show up at an answer. As a feature of the course, you will figure out how to practice and culture the craft of programming with Python as a language.

### Course layout

NOTE: You can check your answer immediately by clicking show answer button. The Joy of Computing using Python Week 6 Solutions” contains 10 questions.

Now, start attempting the quiz.

### The Joy of Computing using Python Week 6 Solutions

Q1. 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.

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

The Joy of Computing using Python week 6 Solutions

Q2. 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

Q3. Which of the following is true about recursion?

a) Recursion always performs better than non-recursive code.
b) Recursive code is easier to debug.
c) The base case is necessary for recursion.
d) Recursive code can be shorter than non-recursive code

Q4. What will be the output of the following program?

a) Calculating sum of first n terms.
b) Calculating product of first n terms.
c) Calculating power of first n terms.
d) Calculating sum of last n terms.

Answer: b) Calculating product of first n terms.

Q5. In Caesar cipher,the mediator needs to make maximum of how many trails to break the code?

a) 1
b) 26
c) no trail needed
d) 10

The Joy of Computing using Python week 6 Solutions

Q6. What is the output of the following program?

a) 3628800
b) Runs into an infinite loop
c) 55
d) Syntax error

Answer: b) Runs into an infinite loop

Q7. What’s the correct code for Binary search?

The Joy of Computing using Python week 6 Solutions

Q8. Which of the following is TRUE about MIN-MAX strategy?

a) Maximize the chances of your winning and minimize the changes of the opponent winning
b) The game with min-max strategy can never be drawn
c) Minimize the chances of your winning and maximize the chances of the opponent winning
d) All the above are true

Answer: a) Maximize the chances of your winning and minimize the changes of the opponent winning

The Joy of Computing using Python week 6 Solutions

Q9. A program that is written recursively cannot be written in a non-recursive manner.

a) True
b) False

Q10. What will be the output of the following program?

a)
**********
*********
********
*******
******
*****
****
***
**
*
b)
*********
*******
*****
***
*
c) Runs into infinite loop
d)
**********
********
******
****
**
*

The Joy of Computing using Python week 6 Solutions

### The Joy of Computing using Python Week 6 Solutions

Q1. Which of the following is true about recursion?

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

Q2. If PYTHON is encoded by TCXLSR then DIAMOND will be encoded as?

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

Q3. 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)

Q4. 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

Q5. 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.

The Joy of Computing using Python Week 6 Solutions

Q6. Library used to import images?

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

Q7. Values of CSV files are separated by?

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

The Joy of Computing using Python Week 6 Solutions

Q8. What will be the output of the following program?

The Joy of Computing using Python Week 6 Solutions

Q9. 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.

Q10. 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.

The Joy of Computing using Python Week 6 Solutions

### The Joy of Computing using Python Week 6 Solutions

Q1. 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

Q2. Which of the following is true about recursion?

a) Recursion always performs better than non-recursive code.
b) Recursive code is easier to debug
c) The base case is necessary for recursion.
d) Recursive code can be shorter than non-recursive code.

Q3. What will be the output of the following program?

a) No output
b) braKa
c) Abra
d) rak

Q4. What will be the output of the following program?

a) Sum of first 10 natural numbers.
b) Sum of first 9 natural numbers.
c) The program will never end.
d) Sum of numbers from 2-10(Both inclusive).

Answer: a) Sum of first 10 natural numbers.

Q5. What’s the correct code for Binary search?

The Joy of Computing using Python Week 6 Solutions

Q6. Which of the following can be used to see the dimension of a NumPy array named ‘arr’?

a) dim(arr)
b) shape(arr)
c) arr.shape
d) arr.shape()

Q7. If PYTHON is encoded by TCXLSR then DIAMOND will be encoded as?

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

The Joy of Computing using Python Week 6 Solutions

Q8. Select the correct statement
1) print(‘9a’.isalnum()) will return True.
2) ‘9a’ contains both alphabetic and numeric parts.

a) Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.
b) Option 1 is correct, option 2 is incorrect.
c) Option 1 is correct, option 2 is correct. Option 2 is not the correct explanation for option 1.
d) Option 1 is incorrect, option 2 is incorrect.

Answer: a) Option 1 is correct, option 2 is correct. Option 2 is the correct explanation for option 1.

The Joy of Computing using Python Week 6 Solutions

Q9. What will be the output of the following program?

a) A dictionary with the count of each character in s.
b) A dictionary with the count of each special character in s.
c) A dictionary with the count of letters in s.
d) Error

Q10. 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)

`DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.`