Sail E0 Webinar

MCQs

Total Questions : 18 | Page 1 of 2 pages
Question 1. Which of the following is true about top-down design process?
  1.    The details of a program design are addressed before the overall design
  2.    Only the details of the program are addressed
  3.    The overall design of the program is addressed before the details
  4.    Only the design of the program is addressed
 Discuss Question
Answer: Option C. -> The overall design of the program is addressed before the details


Top-down design is an approach for deriving a modular design in which the overall design.


Question 2. What is the output of the line of code shown below?pickle.HIGHEST_PROTOCOL
  1.    4
  2.    5
  3.    3
  4.    6
 Discuss Question
Answer: Option A. -> 4


There are five protocol versions available of the pickle module, namely, 0, 1, 2, 3 and 4. In the code shown above, the highest protocol version is returned, that is, 4.


Question 3. What is the output of the function shown below (random module has already been imported)?random.choice('sun')
  1.    sun
  2.    u
  3.    either s, u or n
  4.    error
 Discuss Question
Answer: Option C. -> either s, u or n


The above function works with alphabets just as it does with numbers. The output of thes expression will be either s, u or n.


Question 4. Which of the following will not be returned by random.choice("1 ,)?
  1.    1
  2.    (space)
  3.    ,
  4.    none of the mentioned
 Discuss Question
Answer: Option D. -> none of the mentioned


Any of the characters present in the string may be returned.


Question 5. What is the output of this code?import syseval(sys.stdin.readline())"India"
  1.    India5
  2.    India
  3.    'India\n'
  4.    'India'
 Discuss Question
Answer: Option D. -> 'India'


The function shown above evaluates the input into a string. Hence if the input entered is enclosed in double quotes, the output will be enclosed in single quotes. Therefore, the output of this code is 'India'.


Question 6. Which of the following functions does not accept any arguments?
  1.    position
  2.    fillcolor
  3.    goto
  4.    setheading()
 Discuss Question
Answer: Option A. -> position


The functions fillcolor(), goto() and setheading() accept arguments, whereas the function position() does not accept any arguments. The function position() returns the current position of the turtle.


Question 7. The output of the code shown is similar to the alphabet _______________import turtlet=turtle.Pen()t1=turtle.Pen()t2=turtle.Pen()t.forward(100)t1.forward(100)t2.forward(100)t1.left(90)t1.forward(75)t2.right(90)t2.forward(75)
  1.    X
  2.    N
  3.    T
  4.    M
 Discuss Question
Answer: Option C. -> T


In the above code, three pens have been used to create a shape similar to the letter 'T'. All the three straight lines are mutually perpendicular.


Question 8. What is the output of the following code?import turtlet=turtle.Pen()t.right(90)t.forward(100)t.heading()
  1.    0.0
  2.    90.0
  3.    270.0
  4.    360.0
 Discuss Question
Answer: Option C. -> 270.0


The output of the code shown above will be 270.0. The function heading() returns the heading of the turtle, a value in degrees, counter-clockwise from the horizontal right. The output shape of this code is a straight line pointing downwards.


Question 9. What is the output of the code shown below if the system date is 18th August, 2016?tday=datetime.date.today()print(tday.month())
  1.    August
  2.    Aug
  3.    08
  4.    8
 Discuss Question
Answer: Option D. -> 8


The code shown above prints the month number from the system date. Therefor the output will be 8 if the system date is 18th August, 2016.


Question 10. What is the output of the following?x = [12, 34]print(len(''.join(list(map(str, x)))))
  1.    4
  2.    5
  3.    6
  4.    Error
 Discuss Question
Answer: Option A. -> 4


Each number is mapped into a string of length 2.


Latest Videos

Latest Test Papers