[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL The Joy Of Computing Using Python Assignment Answer

[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

NPTEL The Joy Of Computing Using Python Week 3 Assignment Answer 2023

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

L = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’]
print(L[2:5])

a, b, c
a, b, c, d
c, d, e
c, d, e, f

Answer :- For Answer Click Here

2. Which of the following is a valid way to declare a dictionary in Python?

{1: “one”, 2: “two”, 3: “three”}
[1: “one”, 2: “two”, 3: “three”]
(1: “one”, 2: “two”, 3: “three”)
<1: “one”, 2: “two”, 3: “three”>

Answer :- 

3. Which of the following method is correct to add an element at a specific position?

insert()
add()
append()
index()

Answer :- For Answer Click Here

4. What is the correct syntax to add an item to the end of a list in Python?

list.add(item)
list.append(item)
list.insert(item)
list.extend(item)

Answer :- 

5. Which of the following is not a valid data type in Python?

integer
string
float
character

Answer :- For Answer Click Here

6. What is the output of the following code?

for i in range(1, 21):
    if i % 3 == 0 and i % 5 == 0:
        print("FizzBuzz")
    elif i % 3 == 0:
        print("Fizz")
    elif i % 5 == 0:
        print("Buzz")
    else:
        print(i)

Prints numbers from 1 to 20
Prints Fizz for multiples of 3 and Buzz for multiples of 5
Prints FizzBuzz for multiples of 3 and 5
None of the above

Answer :- For Answer Click Here

7. What is the output of the following code?
a = 5
b = 2
print(a // b)

2
2.5
3
2.0

Answer :- 

8. What is the output of the following code?
s = “hello”
print(s[::-1])

“hello”
“olleh”
“hlo”
“leh”

Answer :- For Answer Click Here

9. What is the output of the following code?
a = 10
b = 5
c = a % b
print(c)

2
5
0
1

Answer :- 

10. What is the output of the following code?
s = “python”
print(s[1:4])

“pyt”
“yth”
“tho”
“hon”

Answer :- For Answer Click Here

NPTEL The Joy Of Computing Using Python Week 2 Assignment Answer 2023

1. Which of the following is a high-level programming language?

  • Assembly
  • C
  • Python
  • Machine Language
Answer :- c

2. Which of the following is an example of a front-end programming language?

  • PHP
  • Java
  • HTML
  • SQL
Answer :- c

3. Which of the following is used to store data in a programming language?

  • Variables
  • Arrays
  • Loops
  • Conditionals
Answer :- a, b

4. Which statement will print ‘The joy of computing’?

  • print(The joy of computing)
  • print The joy of computing
  • printf(‘The joy of computing)
  • print(‘The joy of computing’)
Answer :- d

5. What should be the value of _ to print all numbers from 0-10
[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • 10
  • 9
  • 11
  • None of the above
Answer :- c

6. Which of the following keyword is used to declare a function in a programming language?

  • def
  • var
  • int
  • float
Answer :- a

7. What will be the output of the following code?
[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • 0
  • 45
  • 43
  • 50
Answer :- b

8. What value will c store in it after the execution of the below code?
c=b**3

  • Value of b multiplied by 3
  • Cube of b
  • Value of b multiplied with 3 twice
  • It will throw an error
Answer :- d

9. What will be the output? suppose the input is 30
[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • 60
  • Error
  • 3030
  • 30
Answer :- c

10. What is the output for the following program?
[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • True
  • False
  • It will display an error message
  • Boolean
Answer :- 

NPTEL The Joy Of Computing Using Python Week 1 Assignment Answer 2023

1. What will be the value of my variable at the end of the loop.

[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • 50
  • 40
  • 49
  • 0
Answer :- 40

2. Which of the following is not a type of block in Scratch?

  • Motion
  • Looks
  • Sound
  • Jump
Answer :- Jump

3. What is the main function of the “if” block in Scratch?

  • To repeat a set of instructions
  • To create a loop
  • To control the flow of the program based on a condition
  • To play a sound
Answer :- To control the flow of the program based on a condition

4. Which block in Scratch is used to control the movement of a sprite?

  • Motion
  • Looks
  • Sound
  • Control
Answer :- Motion

5. Imagine sprite to be a scooter. How many times scooter will move forward?
[Week 3] NPTEL The Joy Of Computing Using Python Assignment Answer 2023

  • 7
  • 4
  • 6
  • 5
Answer :- 5

6. Which block in Scratch is used to make a sprite say something?

Motion
Looks
Sound
Control

Answer :- Looks

7. What is the purpose of the “repeat” block in Scratch?

  • To repeat a set of instructions a specific number of times
  • To repeat a set of instructions forever
  • To repeat a set of instructions based on a condition
  • To play a sound repeatedly
Answer :- To repeat a set of instructions a specific number of times

8. Which block in Scratch is used to wait for a certain amount of time before continuing with the program?

  • Motion
  • Looks
  • Sound
  • Control
Answer :- Control

9. Which block in Scratch is used to detect when a sprite touches another sprite?

  • Motion
  • Looks
  • Sound
  • Sensing
Answer :- Sensing

10. What is the purpose of the “broadcast” block in Scratch?

  • To send a message to another sprite
  • To play a sound
  • To move a sprite
  • To change the background color
Answer :- To send a message to another sprite
Course NameThe Joy Of Computing Using Python
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

Leave a comment