Question 74

Which of the following Function Headers in a Python code will result in error?

  1. Adef Compu (X = 100, Y = 10, Z):
  2. Bdef Compu (X, Y, Z = 1):
  3. Cdef Compu (X=100, Y =10, Z=1):
  4. Ddef Compu (X, Y = 10, Z = 1):
Show answerHide answer

Correct answer: (A) def Compu (X = 100, Y = 10, Z):

Explanation

A parameter without a default value cannot follow parameters that have default values. def Compu(X=100, Y=10, Z): raises a SyntaxError.

From DSSSB TGT Computer Science Practice Set 2

This is question 74 of DSSSB TGT Computer Science Practice Set 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.