The Joy of Computing Using Python Week 2 assignment answers ?  In this article we will discuss about the answers of week 1 of joy of computing. The answers shared here will be on our own knowledge. Please use this as your reference. Â
Also Read:Â Â The Joy Of Computing Using Python Week 1 AssignmentÂ
The Joy of Computing Using PythonÂ
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 the aboveÂ
e. None of the aboveÂ
Answer : [ d ] All the aboveÂ
e. None of the aboveÂ
Answer : [ d ] All the aboveÂ
Q2. Which of the following is not the correct Variable Name?
a. ABCÂ
b. Abd23
c. 32asd
d. Ab_cd_23
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 ]Â Â
Q4. Predict the output of following codeÂ
Â
    L = [[1,2,3],[0,4,5],[0,0,6]]
  Code: Â
       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. 3 2 1 5 4 6Â
c. 0 0 0 0 0 0Â
d. 0,0,0,0,0,0
Answer: [ b ]
Q5. Find the errors in the following codeÂ
 Â
 Code:
  n = 10Â
  l = [ ]Â
  for i in range( 10, n+10 ):
     l . append (i**i)
  for i in range ( 10,0,-1 ):Â
     print ( l[i] )Â
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 ?Â
Â
  Code: Â
   def add_items ( x,y):Â
      x+= [ 1,2 ]Â
      y+= ( 3,4 )Â
   l = [ 0 ]
   t = (5, )
   add_items (l, t)
   print (l, end = " " )
   print( t )Â
a. [ 0,1,2 ] ( 5,3,4 )
b. [ 0,1,2 ] ( 5, )
c. [ 0 ] ( 5, 3, 4)Â
d. [ 0 ] (5, )
Answer: [ b ]Â Â
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:Â [ a ]Â Â 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: [ d ]  To skip the current iteration and move on to the next one, but only if a certain condition             is metÂ
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 ]Â Â
Q10. What should be the value of _ to print all numbers from 0-10?Â
 for i in range ( _ ) :Â
    print( i )
a. 11Â
b. 9Â
c. 10.Â
d. None of the aboveÂ
Answer: [ a ]Â 11Â
NPTEL Programming Assignment Â
Q1.  Given an integer as an input , write a program to print that integer.Â
    INPUT: Â
           A NumberÂ
  Â
    OUTPUT:Â
           A NumberÂ
Program :Â
       print(num , end="") {codeBox}
Q2. Given an integer as an input , write a program to print the sum of those integers.Â
Program :Â Â
     Â
        print(num1+num2 , end="") {codeBox}
Q3. You are given a number as an input . You have to display all the numbers from 0 till XÂ
   INPUT: Â
            XÂ
   OUTPUT:
            0 1 2Â
Program :Â
     Â
for a in range(num+1):Â Â Â if a==num:Â Â Â Â print(a,end="")Â Â else:Â Â Â Â print(a) {codeBox}
Â
Also Read:Â Â The Joy Of Computing Using Python Week 1 AssignmentÂ
Conclusion:Â
Finally, these are the answers for Week 2 Assignment. Please recheck on 08 Feb for any Re-correction of answers.Â