This set of MCQ(multiple choice questions) focuses on the The Joy of Computing using Python NPTEL 2023 Week 2 Assignment 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
Answers COMING SOON! Kindly Wait!
Week 0: Assignment answers
Week 1: Assignment answers
Week 2: Assignment answers
Week 3: Assignment answers
Week 4: Assignment answers
Week 5: Assignment answers
Week 6: Assignment answers
Week 7: Assignment answers
Week 8: Assignment answers
Week 9: Assignment answers
Week 10: Assignment answers
Week 11: Assignment answers
Week 12: Assignment answers
NOTE: You can check your answer immediately by clicking show answer button. The Joy of Computing using Python NPTEL 2023 Week 2 Assignment Solution” contains 10 questions.
Now, start attempting the quiz.
The Joy of Computing using Python NPTEL 2023 Week 2 Assignment Solutions
Q1. Which of the following is a high-level programming language?
a) Assembly
b) C
c) Python
d) Machine Language
Answer: c) Python
Q2. Which of the following is an example of a front-end programming language?
a) PHP
b) Java
c) HTML
d) SQL
Answer: c) HTML
Q3. Which of the following is used to store data in a programming language?
a) Variables
b) Arrays
c) Loops
d) Conditionals
Answer: a), b)
Q4. Which statement will print ‘The joy of computing’?
a) print(The joy of computing)
b) print The joy of computing
c) printf(‘The joy of computing’)
d) print(‘The joy of computing’)
Answer: d) print(‘The joy of computing’)
Q5. What should be the value of _ to print all numbers from 0-10
for i in range( _ ) :
print(i)
a) 10
b) 9
c) 11
d) None of the above
Answer: c) 11
Q6. Which of the following keyword is used to declare a function in a programming language?
a) def
b) var
c) int
d) float
Answer: a) def
Q7. What will be the output of the following code?
a) 0
b) 45
c) 43
d) 50
Answer: b) 45
Q8. What value will c store in it after the execution of the below code?
c=b**3
a) Value of b multiplied by 3
b) Cube of b
c) Value of b multiplied with 3 twice
d) It will throw an error
Answer: d) It will throw an error
Q9. What will be the output? suppose the input is 30
a) 60
b) Error
c) 3030
d) 30
Answer: c) 3030
Q10. What is the output for the following program?
a = 3
b = 4
c = a > b
print(c)
a) True
b) False
c) It will display an error message
d) Boolean
Answer: b) False
The Joy of Computing using Python NPTEL 2022 Week 2 Assignment Solutions
Q1. 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
Answer: d) All of the above
Q2. Which of the following is not the correct variable name
a) Abc
b) Abd23
c) 32asd
d) Ab_cd_23
Answer: c) 32asd
Q3. Write the output of the following code.
L = [1,2,3,4,5,6,7,8,9]
print(L[::-1])
a) [1,2,3,4,5,6,7,8,9]
b) [1,2,3,4,5,9,8,7,6]
c) [9,8,7,6,5,4,3,2,1]
d) Error
Answer: c) [9,8,7,6,5,4,3,2,1]
Q4. Predict the output of the following code:
L = [[1,2,3],[0,4,5],[0,0,6]]
a) 3,2,1,5,4,6
b) 3 2 1 5 4 6
c) 0,0,0,0,0,0
d) 0 0 0 0 0 0
Answer: b) 3 2 1 5 4 6
Q5. 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
Answer: a), b)
Q6. 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,)
Answer: b) [0,1,2] (5,)
Q7. What is the correct syntax for defining a function in Python?
a) def function name():
b) function function_name():
c) function_name():
d) def function_name:
Answer: d) def function_name:
Q8. What is the purpose of the continue statement in a for loop?
a) To skip the rest of the current iteration and move on to the next one
b) To terminate the loop and exit the loop block
c) To return to the top of the loop and start a new iteration
d) To skip the current iteration and move on to the next one, but only if a certain condition is met
Answer: a)
Q9. How do you check if a number is even in Python?
a) if number % 2 == 0
b) if number.is_even()
c) if number % 2 is 0
d) if number.even()
Answer: a) if number % 2 == 0
Q10. What should be the value of _ to print all numbers from 0-10?
a) 11
b) 9
c) 10
d) None of the above
Answer: a) 11
Previous Year – The Joy of Computing using Python NPTEL 2022 Week 2 Assignment Solutions
Q1. What is the correct command to show the value stored in a variable?
a) show()
b) cout()
c) print()
d) out()
Answer: c) print()
Q2. What will be the output of the following piece of code?
a = 'Bond'
b = 34
print('Hello Mr.', a, b+1)
a) Hello Mr. Bond 34
b) Hello Mr. 34
c) Hello Mr. Bond 35
d) Hello Mr. Bond 34
Answer: c) Hello Mr. Bond 35
Q3. What will be the output of the following code?
In [3]: x=10 x=y print(x,y)
a) 10, 10
b) 10
c) No output
d) Error
Answer: d) Error
Q4. What is the extension of a python file?
a) sc
b) py
c) md
d) cp
Answer: b) py
Q5. what will be the output of the following code, if the given input is 5?
A = input()
print(A*5)
a) 25
b) 55555
c) 55
d) 5
Answer: b) 55555
Q6. Which of the following commands are correct to take input from a user?
a) n = input(‘Hello’)
b) n = input(“42”)
c) n = input(‘42’)
d) n = input(Hello)
e) n = input()
Answer: a), b), c), e)
Q7. What will be the output of the following code if the input is ‘5’?
a = input('Enter a number')
b = int(a)
print(5*b)
a) 25
b) 25.0
c) Error
d) 5555
Answer: a) 25
Q8. Which of the following blocks of codes are correct?(Assume x and y are initialized)
Answer: b)
Q9. Which of the following statements are correct regarding the following code?
for i in range(a):
a) i will take values from 0 to a.
b) i will take values from 1 to a.
c) i will take values from 0 to a-1.
d) i will take values from 1 to a-1.
Answer: c) i will take values from 0 to a-1.
Q10. What will be the output of the following code?
a = 0
while(a < 10):
a = a+2
print(a)
a) 1,2,3,4,5,6,7,8,9,10
b) 2,4,6,8,10
c) 0,1,2,3,4,5,6,7,8,9,10
d) Error
Answer: b) 2,4,6,8,10
<< Prev- The Joy of Computing using Python Week 1 Assignment Solutions
>> Next- The Joy of Computing using Python Week 3 Assignment Solutions
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.
For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.
Checkout for more NPTEL Courses: Click Here!