On This Page

This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 10

Q1 | who('Arthur')
  • arthur sir
  • sir arthur
  • arthur
  • none of the mentioned
Q2 | min(101*99, 102*98)
  • 9997
  • 9999
  • 9996
  • none of the mentioned
Q3 | What is a variable defined outside a function referred to as?
  • a static variable
  • a global variable
  • a local variable
  • an automatic variable
Q4 | What is a variable defined inside a function referred to as?
  • a global variable
  • a volatile variable
  • a local variable
  • an automatic variable
Q5 | , i = 2)
  • an exception is thrown because of conflicting values
  • 1 2
  • 3 3
  • 3 2
Q6 | ,2,3,4)
  • integer
  • tuple
  • dictionary
  • an exception is thrown
Q7 | If a function doesn’t have a return statement, which of the following does the function return?
  • int
  • Null.
  • none
  • an exception is thrown without the return statement
Q8 | )
  • zzz
  • zz
  • an exception is executed
  • infinite loop
Q9 | ',B='2')
  • string
  • tuple
  • dictionary
  • an exception is thrown
Q10 | What is the type of each element in sys.argv?
  • set
  • list
  • tuple
  • string
Q11 | What is the length of sys.argv?
  • number of arguments
  • number of arguments + 1
  • number of arguments – 1
  • none of the mentioned
Q12 | How are keyword arguments specified in the function heading?
  • one-star followed by a valid identifier
  • one underscore followed by a valid identifier
  • two stars followed by a valid identifier
  • two underscores followed by a valid identifier
Q13 | How many keyword arguments can be passed to a function in a single function call?
  • zero
  • one
  • zero or more
  • one or more
Q14 | , 2, 3])
  • 3 1
  • 1 3
  • error
  • none of the mentioned
Q15 | ): print(foo(i))
  • [0] [1] [2]
  • [0] [0, 1] [0, 1, 2]
  • [1] [2] [3]
  • [1] [1, 2] [1, 2, 3]
Q16 | How are variable length arguments specified in the function heading?
  • one star followed by a valid identifier
  • one underscore followed by a valid identifier
  • two stars followed by a valid identifier
  • two underscores followed by a valid identifier
Q17 | Which module in the python standard library parses options received from the command line?
  • getopt
  • os
  • getarg
  • main
Q18 | What is the type of sys.argv?
  • set
  • list
  • tuple
  • string
Q19 | What is the value stored in sys.argv[0]?
  • Null.
  • you cannot access it
  • the program’s name
  • the first argument
Q20 | How are default arguments specified in the function heading?
  • identifier followed by an equal to sign and the default value
  • identifier followed by the default value within backticks (“)
  • identifier followed by the default value within square brackets ([])
  • identifier
Q21 | Where are the arguments received from the command line stored?
  • sys.argv
  • os.argv
  • argv
  • none of the mentioned
Q22 | f1()
  • error
  • 12
  • 15 d) 1512
Q23 | )
  • 13
  • 10
  • 2
  • 5
Q24 | ,2,3,4 f(5,10,15)
  • 1 2 3 4
  • 5 10 15 4
  • 10 20 30 40
  • 5 10 15 40
Q25 | (1,2) print(total)
  • error
  • 7
  • 8
  • 15