# Python/Python Mcq Set 14 Sample Test,Sample questions

1.Client

2.Docstring

3.Interface

4.Modularity

## 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

## 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

## 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

## Question: ``` What will be the output of the following Python code? x = [, ] print((' '.join(list(map(str, x)))))```

1.(â€˜ â€™,)

2.(â€™01â€™,)

3.  

4.01

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

1.Global namespace

2. Public namespace

3.Built-in namespace

4.Local namespace

1.Interface

2.Modularity

3.Client

4.Docstring

## 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

1.-3.4

2.3.4

3.3

4. -3

## Question: `What is math.factorial(4.0)?`

1. 24

2.1

3. error

4.none of the mentioned

1.8

2.10

3.0

4.9

1.3

2.4

3.4.0

4. 3.0

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

1. 0

2.1

3.error

4.none of the mentioned

1. 720

2.6

3.[1, 2, 3, 6]

4. error

1.3

2.4

3.4.0

4.3.0

1.1

2.1.0

3. -3

4.-3.0

1.24

2. 120

3. error

4. 24.0

## 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

## 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

## 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

## 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

## 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

## 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

## 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))

## 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

## Question: ```What will be the output of the following Python code? x = 1234 print(list(map(list, x)))```

1. [1, 2, 3, 4]

2. 

3. [, , , ]

4.none of the mentioned

## Question: ```What will be the output of the following Python code? x = 1234 print(list(map(list, [x])))```

1.[1, 2, 3, 4]

2. 

3. [, , , ]

4.none of the mentioned

## 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

## 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

## 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

## 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

## 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

## 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

## 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

1. 4

2.5

3.6

4.error

## 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

1.4

2. 5

3.6

4.error

## 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

## 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

1.12 1 34 0

2. 12.1 34

3.121 340

4.12.1 34.0

1. 6

2. 8

3.9

4.error

1.3456

2.(3456)

3.(â€˜3456â€™)

4. (â€˜3456â€™,)

1.3456

2. (3456)

3.(â€˜3456â€™)

4.(â€˜3456â€™,)

1.2

2. 3

3.7

4.8

## 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

## 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

## 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

## 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

## 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

## 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

## 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

## 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

## More MCQS

##### Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite 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!