Python/Python%20Mcq%20Set%2014 Sample Test,Sample questions

Question:
 Program code making use of a given module is called a ______ of the module.

1.Client

2.Docstring

3.Interface

4.Modularity

Posted Date:-2022-01-02 07:37:49


Question:
 What will be the output of the following Python code?

x = 'abcd'
print(list(map(list, x)))

1.[‘a’, ‘b’, ‘c’, ‘d’]

2. [‘abcd’]

3.[[‘a’], [‘b’], [‘c’], [‘d’]]

4.none of the mentioned

Posted Date:-2022-01-02 07:33:10


Question:
 What will be the output of the following Python code?

x = abcd
print(list(map(list, x)))

1.[‘a’, ‘b’, ‘c’, ‘d’]

2.[‘abcd’]

3.[[‘a’], [‘b’], [‘c’], [‘d’]]

4.none of the mentioned

Posted Date:-2022-01-02 07:33:38


Question:
 What will be the output of the following Python code?

x = [34, 56]
print(len(map(str, x)))

1. [34, 56]

2. [’34’, ’56’]

3.34 56

4.error

Posted Date:-2022-01-02 07:32:43


Question:
 What will be the output of the following Python code?

x = [[0], [1]]
print((' '.join(list(map(str, x)))))

1.(‘[0] [1]’,)

2.(’01’,)

3. [0] [1]

4.01

Posted Date:-2022-01-02 07:31:15


Question:
 Which of the following is not a valid namespace?

1.Global namespace

2. Public namespace

3.Built-in namespace

4.Local namespace

Posted Date:-2022-01-02 07:42:07


Question:
 ______ is a string literal denoted by triple quotes for providing the specifications of certain program elements.

1.Interface

2.Modularity

3.Client

4.Docstring

Posted Date:-2022-01-02 07:38:17


Question:
Is the output of the function abs() the same as that of the function math.fabs()?

1.sometimes

2.always

3.never

4.none of the mentioned

Posted Date:-2022-01-02 07:51:00


Question:
What is displayed on executing print(math.fabs(-3.4))?

1.-3.4

2.3.4

3.3

4. -3

Posted Date:-2022-01-02 07:48:03


Question:
What is math.factorial(4.0)?

1. 24

2.1

3. error

4.none of the mentioned

Posted Date:-2022-01-02 07:52:17


Question:
What is math.floor(0o10)?

1.8

2.10

3.0

4.9

Posted Date:-2022-01-02 07:53:01


Question:
What is returned by math.ceil(3.4)?

1.3

2.4

3.4.0

4. 3.0

Posted Date:-2022-01-02 07:45:58


Question:
What is the value of x if x = math.factorial(0)?

1. 0

2.1

3.error

4.none of the mentioned

Posted Date:-2022-01-02 07:51:49


Question:
What is the value returned by math.fact(6)?

1. 720

2.6

3.[1, 2, 3, 6]

4. error

Posted Date:-2022-01-02 07:51:25


Question:
What is the value returned by math.floor(3.4)?

1.3

2.4

3.4.0

4.3.0

Posted Date:-2022-01-02 07:46:22


Question:
What will be the output of print(math.copysign(3, -1))?

1.1

2.1.0

3. -3

4.-3.0

Posted Date:-2022-01-02 07:47:13


Question:
What will be the output of print(math.factorial(4.5))?

1.24

2. 120

3. error

4. 24.0

Posted Date:-2022-01-02 07:52:38


Question:
What will be the output of the following Python code?

#mod1
def change(a):
    b=[x*2 for x in a]
    print(b)
#mod2
def change(a):
    b=[x*x for x in a]
    print(b)
from mod1 import change
from mod2 import change
#main
s=[1,2,3]
change(s)

1. [2,4,6]

2.[1,4,9]

3.[2,4,6] [1,4,9]

4.There is a name clash

Posted Date:-2022-01-02 07:39:21


Question:
What will be the output of the following Python code?

def to_upper(k):
    k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))

1. [‘AB’, ‘CD’]

2.[‘ab’, ‘cd’]

3.none of the mentioned

4.error

Posted Date:-2022-01-02 07:19:55


Question:
What will be the output of the following Python code?

def to_upper(k):
    return k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))

1.[‘AB’, ‘CD’]

2.[‘ab’, ‘cd’]

3.none of the mentioned

4. error

Posted Date:-2022-01-02 07:18:09


Question:
What will be the output of the following Python code?

def to_upper(k):
    return k.upper()
x = ['ab', 'cd']
print(list(map(upper, x)))

1. [‘AB’, ‘CD’]

2. [‘ab’, ‘cd’]

3.none of the mentioned

4. error

Posted Date:-2022-01-02 07:17:44


Question:
What will be the output of the following Python code?

elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(elements, incr)))

1.[1, 2, 3]

2.[0, 1, 2]

3.error

4.none of the mentioned

Posted Date:-2022-01-02 07:16:25


Question:
What will be the output of the following Python code?

elements = [0, 1, 2]
def incr(x):
    return x+1
print(list(map(incr, elements)))

1. [1, 2, 3]

2.[0, 1, 2]

3.error

4.none of the mentioned

Posted Date:-2022-01-02 07:16:54


Question:
What will be the output of the following Python code?

from math import factorial
print(math.factorial(5))

1.120

2.Nothing is printed

3.Error, method factorial doesn’t exist in math module

4.Error, the statement should be: print(factorial(5))

Posted Date:-2022-01-02 07:44:38


Question:
What will be the output of the following Python code?

x = 'abcd'
print(list(map([], x)))

1. [‘a’, ‘b’, ‘c’, ‘d’]

2.[‘abcd’]

3. [[‘a’], [‘b’], [‘c’], [‘d’]]

4.none of the mentioned

Posted Date:-2022-01-02 07:34:56


Question:
What will be the output of the following Python code?

x = 1234
print(list(map(list, x)))

1. [1, 2, 3, 4]

2. [1234]

3. [[1], [2], [3], [4]]

4.none of the mentioned

Posted Date:-2022-01-02 07:34:03


Question:
What will be the output of the following Python code?

x = 1234
print(list(map(list, [x])))

1.[1, 2, 3, 4]

2. [1234]

3. [[1], [2], [3], [4]]

4.none of the mentioned

Posted Date:-2022-01-02 07:34:31


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(len(list(map(list, x))))

1. 2

2.4

3. error

4.none of the mentioned

Posted Date:-2022-01-02 07:22:00


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(len(list(map(list, x))))))

1.2

2. 4

3. error

4.none of the mentioned

Posted Date:-2022-01-02 07:23:23


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(len(map(list, x)))

1. [2, 2]

2.2

3. 4

4.none of the mentioned

Posted Date:-2022-01-02 07:21:33


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(list(map(len, x)))

1.[‘ab’, ‘cd’]

2. [2, 2]

3.[‘2’, ‘2’]

4. None of the mentioned

Posted Date:-2022-01-02 07:21:06


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(list(map(list, x)))

1.[‘a’, ‘b’, ‘c’, ‘d’]

2.[[‘ab’], [‘cd’]]

3.[[‘a’, ‘b’], [‘c’, ‘d’]]

4.none of the mentioned

Posted Date:-2022-01-02 07:24:24


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(list(map(upper, x)))

1. [‘AB’, ‘CD’]

2.[‘ab’, ‘cd’]

3. error

4.none of the mentioned

Posted Date:-2022-01-02 07:17:19


Question:
What will be the output of the following Python code?

x = ['ab', 'cd']
print(map(len, x))

1.[‘ab’, ‘cd’]

2. [2, 2]

3. [‘2’, ‘2’]

4. None of the mentioned

Posted Date:-2022-01-02 07:20:43


Question:
What will be the output of the following Python code?

x = [12, 34]
print(len(' '.join(list(map(int, x)))))

1. 4

2.5

3.6

4.error

Posted Date:-2022-01-02 07:29:09


Question:
What will be the output of the following Python code?

x = [12, 34]
print(len(''.join(list(map(int, x)))))

1. 4

2. 2

3. error

4.none of the mentioned

Posted Date:-2022-01-02 07:27:54


Question:
What will be the output of the following Python code?

x = [12, 34]
print(len(''.join(list(map(str, x)))))

1.4

2. 5

3.6

4.error

Posted Date:-2022-01-02 07:28:27


Question:
What will be the output of the following Python code?

x = [12, 34]
print(len(list(map(int, x))))

1.2

2.1

3.error

4.none of the mentioned

Posted Date:-2022-01-02 07:27:18


Question:
What will be the output of the following Python code?

x = [12, 34]
print(len(list(map(len, x))))

1.2

2.1

3.error

4.none of the mentioned

Posted Date:-2022-01-02 07:26:50


Question:
What will be the output of the following Python code?

x = [12.1, 34.0]
print(' '.join(list(map(str, x))))

1.12 1 34 0

2. 12.1 34

3.121 340

4.12.1 34.0

Posted Date:-2022-01-02 07:30:02


Question:
What will be the output of the following Python code?

x = [12.1, 34.0]
print(len(' '.join(list(map(str, x)))))

1. 6

2. 8

3.9

4.error

Posted Date:-2022-01-02 07:29:37


Question:
What will be the output of the following Python code?

x = [34, 56]
print((''.join(list(map(str, x)))),)

1.3456

2.(3456)

3.(‘3456’)

4. (‘3456’,)

Posted Date:-2022-01-02 07:32:18


Question:
What will be the output of the following Python code?

x = [34, 56]
print((''.join(list(map(str, x))),))

1.3456

2. (3456)

3.(‘3456’)

4.(‘3456’,)

Posted Date:-2022-01-02 07:31:53


Question:
What will be the output of the following Python code?

x = [[0], [1]]
print(len(' '.join(list(map(str, x)))))

1.2

2. 3

3.7

4.8

Posted Date:-2022-01-02 07:30:29


Question:
Which of the following is false about “from-import” form of import?

1.The syntax is: from modulename import identifier

2. This form of import prevents name clash

3.The namespace of imported module becomes part of importing module

4.The identifiers in module are accessed directly as: identifier

Posted Date:-2022-01-02 07:43:40


Question:
Which of the following is false about “import modulename” form of import?

1. The namespace of imported module becomes part of importing module

2.This form of import prevents name clash

3.The namespace of imported module becomes available to importing module

4. The identifiers in module are accessed as: modulename.identifier

Posted Date:-2022-01-02 07:43:08


Question:
Which of the following is not an advantage of using modules?

1. Provides a means of reuse of program code

2.Provides a means of dividing up tasks

3.Provides a means of reducing the size of the program

4.Provides a means of testing individual parts of the program

Posted Date:-2022-01-02 07:37:21


Question:
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

Posted Date:-2022-01-02 07:38:44


Question:
Which of the following isn’t true about main modules?

1.When a python file is directly executed, it is considered main module of a program

2.Main modules may import any number of modules

3.Special name given to main modules is: __main__

4.Other main modules can import main modules

Posted Date:-2022-01-02 07:41:03


Question:
Which of the statements about modules is false?

1. In the “from-import” form of import, identifiers beginning with two underscores are private and aren’t imported

2.dir() built-in function monitors the items in the namespace of the main module

3.In the “from-import” form of import, all identifiers regardless of whether they are private or public are imported

4.When a module is loaded, a compiled version of the module with file extension .pyc is automatically produced

Posted Date:-2022-01-02 07:44:10


Question:
Which of these definitions correctly describes a module?

1.Denoted by triple quotes for providing the specification of certain program elements

2.Design and implementation of specific functionality to be incorporated into a program

3.Defines the specification of how it is to be used

4.Any program that reuses code

Posted Date:-2022-01-02 07:36:56


Question:
which of these is false about a package?

1. A package can have subfolders and modules

2.Each import package need not introduce a namespace

3. import folder.subfolder.mod1 imports packages

4.from folder.subfolder.mod1 import objects imports packages

Posted Date:-2022-01-02 07:35:51


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Test
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!