Problem Solving And Python Programming Set 28
On This Page
This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 28
Q1 | What is a variable defined inside a function referred to as?
- a global variable
- a volatile variable
- a local variable
- an automatic variable
Q2 | , i = 2)
- an exception is thrown because of conflicting values
- 1 2
- 3 3
- 3 2
Q3 | ,2,3,4)
- integer
- tuple
- dictionary
- an exception is thrown
Q4 | 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
Q5 | )
- zzz
- zz
- an exception is executed
- infinite loop
Q6 | ',B='2')
- string
- tuple
- dictionary
- an exception is thrown
Q7 | What is the type of each element in sys.argv?
- set
- list
- tuple
- string
Q8 | What is the length of sys.argv?
- number of arguments
- number of arguments + 1
- number of arguments – 1
- none of the mentioned
Q9 | 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
Q10 | How many keyword arguments can be passed to a function in a single function call?
- zero
- one
- zero or more
- one or more
Q11 | , 2, 3])
- 3 1
- 1 3
- error
- none of the mentioned
Q12 | print(foo())
- 0
- 1
- error
- none of the mentioned
Q13 | ): print(foo(i))
- [0] [1] [2]
- [0] [0, 1] [0, 1, 2]
- [1] [2] [3]
- [1] [1, 2] [1, 2, 3]
Q14 | 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
Q15 | Which module in the python standard library parses options received from the command line?
- getopt
- os
- getarg
- main
Q16 | What is the type of sys.argv?
- set
- list
- tuple
- string
Q17 | What is the value stored in sys.argv[0]?
- Null.
- you cannot access it
- the program’s name
- the first argument
Q18 | 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
Q19 | Where are the arguments received from the command line stored?
- sys.argv
- os.argv
- argv
- none of the mentioned
Q20 | f1()
- error
- 12
- 15 d) 1512
Q21 | san(12)
- 13
- 10
- 2
- 5
Q22 | ,2,3,4 f(5,10,15)
- 1 2 3 4
- 5 10 15 4
- 10 20 30 40
- 5 10 15 40
Q23 | (1,2) print(total)
- error
- 7
- 8
- 15
Q24 | Which of the following data structures is returned by the functions globals() and locals()?
- list
- set
- dictionary
- tuple