Pregunta 1
Pregunta
1. What is the output of print str if str = 'Hello World!'?
Respuesta
-
Hello World
-
Hello World!
-
World
-
‘Hello World!’
Pregunta 2
Pregunta
What is the output of print str * 2 if str = 'Hello World!'?
Pregunta 3
Pregunta
Which of the following is correct about dictionaries in python?
Respuesta
-
Python's dictionaries are kind of hash table type
-
They work like associative arrays or hashes found in Perl and consist of key-value pairs
-
A dictionary key can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object
-
All of the above
Pregunta 4
Pregunta
What is the output of print tinylist * 2 if tinylist = [123, 'john']?
Pregunta 5
Pregunta
What is the output of print str[2:] if str = 'Hello World!'?
Respuesta
-
llo World!
-
H
-
llo
-
Hello World!
Pregunta 6
Pregunta
What is the output of len([1, 2, 3])?
Pregunta 7
Pregunta
What is the output of print str * 2 if str = 'Hello World!'?
Respuesta
-
Hello World!Hello World!
-
Hello World! * 2
-
error
-
2
Pregunta 8
Pregunta
Which of the following function convert an integer to a character in python?
Respuesta
-
set(x)
-
dict(d)
-
frozenset(s)
-
chr(x)
Pregunta 9
Pregunta
Which of the following function checks in a string that all characters are in lowercase?
Respuesta
-
islower()
-
isnumeric()
-
isspace()
-
istitle()
Pregunta 10
Pregunta
Which of the following function returns the max alphabetical character from the string str?
Respuesta
-
lower()
-
lstrip()
-
max(str)
-
min(str)
Pregunta 11
Pregunta
Which of the following is correct about Python?
Respuesta
-
It supports functional and structured programming methods as well as OOP.
-
It can be used as a scripting language or can be compiled to byte-code for building large applications.
-
It provides very high-level dynamic data types and supports dynamic type checking.
-
All of the above
Pregunta 12
Pregunta
What is the output of L[1:] if L = [1,2,3]?
Respuesta
-
2,3
-
2
-
3
-
None of the above.
Pregunta 13
Pregunta
What is the output of L[-2] if L = [1,2,3]?
Pregunta 14
Pregunta
What is the following function sorts a list?
Respuesta
-
list.reverse()
-
list.sort()
-
list.pop(obj=list[-1])
-
list.remove(obj)
Pregunta 15
Pregunta
State the output that would be produced from the following statement, when written in Python code: print “3”+”3”
Pregunta 16
Pregunta
State the output that would be produced from the following statement, when written in Python code: print 3+3
Pregunta 17
Pregunta
State the output that would be produced from the following statement, when written in Python code: print “3” * 3
Pregunta 18
Pregunta
What is the output of print str[2:5] if str = 'Hello World!'?
Respuesta
-
llo World!
-
H
-
llo
-
None of the above.
Pregunta 19
Pregunta
Which of the following function converts a string to all uppercase?
Respuesta
-
upper()
-
isdecimal()
-
swapcase()
-
title()
Pregunta 20
Pregunta
Which of the following function converts a string to all lowercase?
Respuesta
-
upper()
-
isdecimal()
-
lower()
-
title()
Pregunta 21
Pregunta
Functions must be defined first ____________ they can be called
Respuesta
-
Before
-
After
-
Between
-
At the same time
Pregunta 22
Pregunta
What is the output of for x in [1, 2, 3]: print x?
Pregunta 23
Pregunta
What is the output when following statement is executed print “a”+ “bc” ?
Pregunta 24
Pregunta
What is the output when we execute print (list("hello"))?
Respuesta
-
[‘h’, ’e’, ’l’, ‘l’, ‘o’]
-
[‘hello’]
-
[‘llo’]
-
{‘hello’}
Pregunta 25
Pregunta
What is the output from the following code str1="helloworld", str1[::-1]?
Respuesta
-
dlrowolleh
-
hello
-
world
-
helloworld
Pregunta 26
Pregunta
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
Respuesta
-
[2, 33, 222, 14]
-
Error
-
25
-
[25, 14, 222, 33, 2]
Pregunta 27
Pregunta
Which of the following is a Python tuple?
Respuesta
-
[1, 2, 3]
-
(1, 2 ,3)
-
{1, 2, 3}
-
{}
Pregunta 28
Pregunta
Is Python case sensitive when dealing with identifiers?
Pregunta 29
Pregunta
Which of the following cannot be a variable?
Pregunta 30
Pregunta
Supports ‘Last in, first out’ ordering of data
Respuesta
-
Queue
-
Stack
-
Tuple
-
Dictionary
Pregunta 31
Pregunta
Which of the following is correct output of “print type(1/2)”?
Respuesta
-
<type 'int'>.
-
<type 'number'>
-
<type 'float'>
-
<type 'double'>
-
<type 'tuple'>
Pregunta 32
Pregunta
Which of the following is correct output of “print type([1,2])”?
Respuesta
-
<type 'list'>
-
<type 'number'>
-
<type 'float'>
-
<type 'double'>
-
<type 'tuple'>
Pregunta 33
Pregunta
Which of the following is correct output of “import math print(math.floor(5.6))”?
Pregunta 34
Pregunta
Which of the following is correct output of “colors = [‘Red’, ‘Black’, ‘White’, ‘Green’] x = colors.index(“White”) print(x)”?
Pregunta 35
Pregunta
Which of the following is correct output of “x = 12 y = 18 x = y y = x print(x,y)”?
Pregunta 36
Pregunta
Which of the following is correct output of “x = ‘abcd’ y = 10 print(x+y)”?
Pregunta 37
Pregunta
Which of the following is correct output of “colors = [‘Red’, ‘Black’, ‘White’, ‘Green’] print(colors[-2][-2])”?
Pregunta 38
Pregunta
Which of the following statement is Python comment?
Respuesta
-
*This is a Python comment
-
#This Is a Python comment
-
none of the above
-
//This is a Python comment
Pregunta 39
Pregunta
Which of the following code will add a new color ‘Black’ at the end of the list?
Respuesta
-
colors.insert('black')
-
colors.add('black')
-
colors.append('black')
-
colors+=('black')
Pregunta 40
Pregunta
Which of the following expression is called for an user input?
Respuesta
-
input
-
read
-
none of the above
-
for
Pregunta 41
Pregunta
Which of the following is correct output of “colors = [‘red’, ‘white’, ‘Blue’, ‘green’] print(colors[-2])?
Respuesta
-
'white'
-
'blue'
-
'red'
-
'green'
Pregunta 42
Pregunta
Which of the following is correct output of “print(type([1,2,3]))”?
Respuesta
-
<class 'list'>
-
<class 'tuple'>
-
<class 'set'>
-
<class 'type'>
Pregunta 43
Pregunta
Which of the following is correct about Python?
Respuesta
-
python is a high-level, interpreted, interactive and object-oriented scripting language
-
python is designed to be highly readable
-
it uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages
-
all Of The Above
Pregunta 44
Pregunta
Is python a case sensitive language?
Pregunta 45
Pregunta
Which of the following data types is not supported in python?
Respuesta
-
numbers
-
string
-
list
-
slice
Pregunta 46
Pregunta
Which of the following data types is not supported in python?
Respuesta
-
tuple
-
dictionary
-
generics
-
list
Pregunta 47
Pregunta
What is the output of print str if str = 'Hello World!'?
Respuesta
-
Hello World!
-
error
-
str
-
none of the above
Pregunta 48
Pregunta
What is the output of print str[0] if str = 'Hello World!'?
Respuesta
-
Hello World!
-
H
-
ello World!
-
str
Pregunta 49
Pregunta
What is the output of print str[2:5] if str = 'Hello World!'?
Respuesta
-
Hello World!
-
llo World!
-
H
-
llo
Pregunta 50
Pregunta
_________________ in Python are identified as a contiguous set of characters in between quotation marks
Respuesta
-
numbers
-
strings
-
list
-
tuple
Pregunta 51
Pregunta
What is the output of print list if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Respuesta
-
[ 'abcd', 786, 2.23, 'john', 70.2]
-
list
-
error
-
[ 'abcd', 786, 2.23, 'john']
Pregunta 52
Pregunta
What is the output of print list[0] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Respuesta
-
[ 'abcd', 786, 2.23, 'john', 70.2]
-
list
-
error
-
[ 'abcd']
Pregunta 53
Pregunta
What is the output of print list[1:3] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Respuesta
-
[ 'abcd', 786, 2.23, 'john', 70.2]
-
list
-
[786, 2.23, 'john']
-
[ 'abcd']
Pregunta 54
Pregunta
What is the output of print list[2:] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Respuesta
-
[ 'abcd', 786, 2.23, 'john', 70.2]
-
[786, 2.23, 'john', 70.2]
-
[2.23, 'john', 70.2]
-
[ 'abcd']
Pregunta 55
Pregunta
What is the output of print tinylist * 2 if tinylist = [123, 'john']?
Pregunta 56
Pregunta
Which of the following operator in python performs exponential (power) calculation on operands?
Pregunta 57
Pregunta
Which of the following function changes case for all letters in string?
Respuesta
-
swap(old, new [, max])
-
strip([chars])
-
swapcase().
-
title()
Pregunta 58
Pregunta
What is the output of ['Hi!'] * 4?
Pregunta 59
Pregunta
What is the following function sorts a list?
Respuesta
-
list.reverse()
-
list.sort([func])
-
list.pop(obj=list[-1])
-
list.remove(obj)
Pregunta 60
Pregunta
Following set of commands are executed in shell, what will be the output? >>>str="Hello" >>>str[:2]
Pregunta 61
Pregunta
What kind of error occurs when you execute the following code apple = mango?
Respuesta
-
Syntaxerror
-
Nameerror
-
Valueerror
-
Typeerror
Pregunta 62
Pregunta
Select all options that will correctly print “hello-how-are-you”?
Respuesta
-
print(‘hello’, ‘how’, ‘are’, ‘you’)
-
print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
-
print(‘hello-‘ + ‘how-are-you’)
-
print(‘hello’, ‘how’, ‘are’)
Pregunta 63
Pregunta
What is the answer of this expression, 22 % 3?
Pregunta 64
Pregunta
You can’t perform mathematical operation on String?
Pregunta 65
Pregunta
Operators with the same precedence are evaluated in which manner?
Respuesta
-
left to right
-
right to left
Pregunta 66
Pregunta
How will you get ‘min’ alphabetical character from the string?
Respuesta
-
min(str)
-
max(str)
-
min(int)
-
lower()
Pregunta 67
Pregunta
How will you get ‘max’ alphabetical character from the string?
Respuesta
-
min(str)
-
max(str)
-
min(int)
-
lower()
Pregunta 68
Pregunta
How will you convert a string to all lowercase?
Respuesta
-
min(str)
-
max(str)
-
min(int)
-
lower()
Pregunta 69
Pregunta
Which of the following is invalid?
Respuesta
-
_a = 1
-
__a = 1
-
__str__ = 1
-
a% = 1
Pregunta 70
Pregunta
Which of the following is an invalid variable?
Respuesta
-
my_string_1
-
1st_string
-
foo
-
alua
Pregunta 71
Pregunta
Why are local variable names beginning with an underscore discouraged?
Respuesta
-
They Are Used To Indicate a Private Variables of a Class
-
They confuse the interpreter
-
They are used to indicate global variables
-
They slow down execution
Pregunta 72
Pregunta
Which of the following is not a keyword?
Respuesta
-
eval
-
assert
-
nonlocal
-
pass
Pregunta 73
Pregunta
All keywords in Python are in
Respuesta
-
lower case
-
upper case
-
Capitalized
-
none
Pregunta 74
Pregunta
Which of the following is true for variable names in Python?
Pregunta 75
Pregunta
Which of the following is an invalid statement?
Respuesta
-
abc = 1,000,000
-
a b c = 1000.2000.3000
-
a,b,c = 1000, 2000, 3000
-
a_b_c = 1,000,000
Pregunta 76
Pregunta
Which of the following cannot be a variable?
Pregunta 77
Pregunta
What does the function re.match do?
Respuesta
-
Matches a Pattern at the Start of the String
-
matches a pattern at any position in the string
-
such a function does not exist
-
none of the mentioned
Pregunta 78
Pregunta
Which of the following is incorrect?
Respuesta
-
float(‘inf’)
-
float(‘nan’)
-
float(’56’+’78’)
-
float(’12+34′)
Pregunta 79
Pregunta
Int(x) means variable x is converted to integer
Pregunta 80
Pregunta
Can You perform mathematical operation with String?
Pregunta 81
Pregunta
Which of the following logical operator is correct for definition “If both the operands are true then then condition becomes true”
Respuesta
-
And
-
No correct answer
-
Not
-
In
Pregunta 82
Pregunta
Which of the following logical operator is correct for definition “If both the operands are false then then condition becomes true”
Respuesta
-
And
-
No correct answer
-
Not
-
OR
Pregunta 83
Pregunta
Which of the following logical operator is correct for definition “If one of the operands is false, second is true then condition becomes false”
Respuesta
-
And
-
No correct answer
-
IN
-
OR
Pregunta 84
Pregunta
Which of the following logical operator is correct for definition “If one of the operands is false, second is true then condition becomes true”
Respuesta
-
And
-
No correct answer
-
IN
-
OR
Pregunta 85
Pregunta
Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true
Pregunta 86
Pregunta
Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true
Pregunta 87
Pregunta
Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true
Pregunta 88
Pregunta
Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true
Pregunta 89
Pregunta
Choose the correct expressing computations definition for “Get data from the keyboard, a file, or some other device”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 90
Pregunta
Choose the correct expressing computations definition for “Display data on the screen or send data to a file or other device”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 91
Pregunta
Choose the correct expressing computations definition for “Perform basic mathematical operations like addition and multiplication”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 92
Pregunta
Choose the correct expressing computations definition for “Check for certain conditions and execute the appropriate code”
Respuesta
-
Input
-
Output
-
Conditional logic
-
Repetition
Pregunta 93
Pregunta
Choose the correct expressing computations definition for “Perform some action repeatedly, usually with some variation”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 94
Pregunta
Choose the correct definition for High level code
Respuesta
-
Syntax a specific type of computer can understand
-
Also known as Assembly or Machine Code
-
Rare to directly create now
-
Human friendly syntax
Pregunta 95
Pregunta
_________________is a name that refers to a value
Respuesta
-
Variable
-
Name
-
Value
-
Nothing
Pregunta 96
Pregunta
_______________________is used to create variables and to give them values
Respuesta
-
Assignment statement
-
Variable
-
Naming
-
Statement
Pregunta 97
Pregunta
We can use the ______________ function to check the type of a variable
Respuesta
-
Type()
-
Check()
-
Variable()
-
Str()
Pregunta 98
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a string”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 99
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a integer”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 100
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a float”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 101
Pregunta
Choose the keyword that cannot be used as names for variables as they already have a meaning and purpose.
Respuesta
-
def
-
definition
-
purpose
-
printing
Pregunta 102
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “index starts at 0”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 103
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “reversing from the last value”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 104
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “subset of the values”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 105
Pregunta
in python we use data type, that has keys with values called?
Respuesta
-
Lists
-
Dictionaries
-
Dairies
-
Compounds
Pregunta 106
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print everything from the dictionary?
Respuesta
-
print numbers
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 107
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print dictionary keys?
Respuesta
-
print numbers
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 108
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print Alex’s telephone number?
Respuesta
-
print numbers[‘alex’]
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 109
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary key?
Respuesta
-
‘john’
-
756
-
'alua’
-
numbers.keys
Pregunta 110
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary value?
Respuesta
-
‘john’
-
756
-
‘456’
-
numbers.keys
Pregunta 111
Pregunta
choose the correct definition for ‘syntax error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 112
Pregunta
choose the correct definition for ‘type error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 113
Pregunta
choose the correct definition for ‘name error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 114
Pregunta
Functions must be defined ___________ they can be called?
Respuesta
-
After
-
Before
-
Instead
-
With def keyword
Pregunta 115
Pregunta
Which of the following is the use of function in python?
Respuesta
-
Functions are reusable pieces of programs
-
Functions don’t provide better modularity for your application
-
you can’t also create your own functions
-
All of the mentioned
Pregunta 116
Pregunta
Which keyword is use for function?
Pregunta 117
Pregunta
What is the output of the below program ?
Pregunta 118
Pregunta
What is the output of the below program ?
Respuesta
-
3
-
4
-
4 is maximum
-
3 is maximum
Pregunta 119
Pregunta
What is the output of the below program ?
Respuesta
-
x is 50 Changed global x to 2 Value of x is 50
-
x is 50 Changed global x to 2 Value of x is 2
-
x is 50 Changed global x to 50 Value of x is 50
-
x is 50 Changed global x to 50 Value of x is 2
Pregunta 120
Pregunta
Which are the advantages of functions in python?
Respuesta
-
Reducing duplication of code
-
Decomposing complex problems into simpler pieces
-
Improving clarity of the code
-
All of the mentioned
Pregunta 121
Pregunta
What are the two types of functions?
Respuesta
-
Custom function and Built-in function
-
Built-in function and User-Defined function
-
Custom function and System function
-
System function and User-Defined function
Pregunta 122
Pregunta
Where is function defined?
Respuesta
-
Module
-
Class
-
Another function
-
All of the mentioned
Pregunta 123
Pregunta
What is the output of below program ?
Pregunta 124
Pregunta
What is the output of below program ?
Pregunta 125
Pregunta
What are the keys? for d = {"john":40, "peter":45}
Respuesta
-
“john”, 40, 45, and “peter”
-
“john” and “peter”
-
40 and 45
-
d = (40:”john”, 45:”peter”)
Pregunta 126
Pregunta
What will be the output ?
Pregunta 127
Pregunta
What will be the output ?
Pregunta 128
Pregunta
What will be the output
Pregunta 129
Pregunta
What is the output for code? >> d = {"john":40, "peter":45} >> d["john"]
Pregunta 130
Pregunta
Suppose d = {“john”:40, “peter”:45}, what happens when retieving a value using d[“susan”]?
Respuesta
-
Since “susan” is not a value in the set, Python raises a KeyError exception.
-
It is executed fine and no exception is raised, and it returns None.
-
Since “susan” is not a key in the set, Python raises a KeyError exception.
-
Since “susan” is not a key in the set, Python raises a syntax error.
Pregunta 131
Pregunta
Choose the correct expressing computations definition for “Display data on the screen or send data to a file or other device”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 132
Pregunta
Choose the correct expressing computations definition for “Perform basic mathematical operations like addition and multiplication”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 133
Pregunta
Choose the correct expressing computations definition for “Check for certain conditions and execute the appropriate code”
Respuesta
-
Input
-
Output
-
Conditional logic
-
Repetition
Pregunta 134
Pregunta
Choose the correct expressing computations definition for “Perform some action repeatedly, usually with some variation”
Respuesta
-
Input
-
Output
-
Maths
-
Repetition
Pregunta 135
Pregunta
Choose the correct definition for High level code
Respuesta
-
Syntax a specific type of computer can understand
-
Also known as Assembly or Machine Code
-
Rare to directly create now
-
Human friendly syntax
Pregunta 136
Pregunta
_________________is a name that refers to a value
Respuesta
-
Variable
-
Name
-
Value
-
Nothing
Pregunta 137
Pregunta
_______________________is used to create variables and to give them values
Respuesta
-
Assignment statement
-
Variable
-
Naming
-
Statement
Pregunta 138
Pregunta
We can use the ______________ function to check the type of a variable
Respuesta
-
Type()
-
Check()
-
Variable()
-
Str()
Pregunta 139
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a string”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 140
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a integer”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 141
Pregunta
We can alter the type of a variable using the following functions, which is “converts variable to a float”
Respuesta
-
Type()
-
Int()
-
Float()
-
Str()
Pregunta 142
Pregunta
Choose the keyword that cannot be used as names for variables as they already have a meaning and purpose.
Respuesta
-
def
-
definition
-
purpose
-
printing
Pregunta 143
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “index starts at 0”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 144
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “reversing from the last value”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 145
Pregunta
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “subset of the values”
Respuesta
-
mylist[0]
-
mylist[-1]
-
mylist[2:4]
-
mylist[1]
Pregunta 146
Pregunta
in python we use data type, that has keys with values called?
Respuesta
-
Lists
-
Dictionaries
-
Dairies
-
Compounds
Pregunta 147
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print everything from the dictionary?
Respuesta
-
print numbers
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 148
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print dictionary keys?
Respuesta
-
print numbers
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 149
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print Alex’s telephone number?
Respuesta
-
print numbers[‘alex’]
-
telnumbers
-
telnumbers[‘alex’]
-
telnumbers.keys()
Pregunta 150
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary key?
Respuesta
-
‘john’
-
756
-
‘alua’
-
numbers.keys
Pregunta 151
Pregunta
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary value?
Respuesta
-
‘john’
-
756
-
‘456’
-
numbers.keys
Pregunta 152
Pregunta
choose the correct definition for ‘syntax error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 153
Pregunta
choose the correct definition for ‘type error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 154
Pregunta
choose the correct definition for ‘name error’
Respuesta
-
The structure or tokens in the code are wrong
-
An operation is applied to data of the wrong type
-
Referring to a variable that has not been assigned a value
-
None of the mentioned
Pregunta 155
Pregunta
Functions must be defined ___________ they can be called?
Respuesta
-
After
-
Before
-
Instead
-
With def keyword
Pregunta 156
Pregunta
Which of the following is the use of function in python?
Respuesta
-
Functions are reusable pieces of programs
-
Functions don’t provide better modularity for your application
-
you can’t also create your own functions
-
All of the mentioned
Pregunta 157
Pregunta
Which keyword is use for function?
Pregunta 158
Pregunta
What is the output of the below program ?
Pregunta 159
Pregunta
What is the output of the below program ?
Respuesta
-
3
-
4
-
4 is maximum
-
3 is maximum
Pregunta 160
Pregunta
What is the output of the below program ?
Respuesta
-
x is 50 Changed global x to 2 Value of x is 50
-
x is 50 Changed global x to 2 Value of x is 2
-
x is 50 Changed global x to 50 Value of x is 50
-
x is 50 Changed global x to 50 Value of x is 2
Pregunta 161
Pregunta
Which are the advantages of functions in python?
Respuesta
-
Reducing duplication of code
-
Decomposing complex problems into simpler pieces
-
Improving clarity of the code
-
All of the mentioned
Pregunta 162
Pregunta
What are the two types of functions?
Respuesta
-
Custom function and Built-in function
-
Built-in function and User-Defined function
-
Custom function and System function
-
System function and User-Defined function
Pregunta 163
Pregunta
Where is function defined?
Respuesta
-
Module
-
Class
-
Another function
-
All of the mentioned
Pregunta 164
Pregunta
What is the output of below program ?
Pregunta 165
Pregunta
What is the output of below program ?
Pregunta 166
Pregunta
What are the keys? for d = {"john":40, "peter":45}
Respuesta
-
“john”, 40, 45, and “peter”
-
“john” and “peter”
-
40 and 45
-
d = (40:”john”, 45:”peter”)
Pregunta 167
Pregunta
What will be the output ?
Pregunta 168
Pregunta
What will be the output ?
Pregunta 169
Pregunta
What will be the output ?
Pregunta 170
Pregunta
What is the output for code? >> d = {"john":40, "peter":45} >> d["john"]
Pregunta 171
Pregunta
Suppose d = {“john”:40, “peter”:45}, what happens when retieving a value using d[“susan”]?
Respuesta
-
Since “susan” is not a value in the set, Python raises a KeyError exception.
-
It is executed fine and no exception is raised, and it returns None.
-
Since “susan” is not a key in the set, Python raises a KeyError exception.
-
Since “susan” is not a key in the set, Python raises a syntax error.
Pregunta 172
Pregunta
What is the output of the below program ?
Respuesta
-
x is 50 Changed global x to 2 Value of x is 50
-
x is 50 Changed global x to 2 Value of x is 2
-
x is 50 Changed global x to 50 Value of x is 50
-
x is 50 Changed global x to 50 Value of x is 2
Pregunta 173
Pregunta
Which are the advantages of functions in python?
Respuesta
-
Reducing duplication of code
-
Decomposing complex problems into simpler pieces
-
Improving clarity of the code
-
All of the mentioned
Pregunta 174
Pregunta
What are the two types of functions?
Respuesta
-
Custom function and Built-in function
-
Built-in function and User-Defined function
-
Custom function and System function
-
System function and User-Defined function
Pregunta 175
Pregunta
Where is function defined?
Respuesta
-
Module
-
Class
-
Another function
-
All of the mentioned
Pregunta 176
Pregunta
What is the output of below program ?
Pregunta 177
Pregunta
What is the output of below program ?
Pregunta 178
Pregunta
What are the keys? for d = {"john":40, "peter":45}
Respuesta
-
“john”, 40, 45, and “peter”
-
“john” and “peter”
-
40 and 45
-
d = (40:”john”, 45:”peter”)
Pregunta 179
Pregunta
What will be the output ?
Pregunta 180
Pregunta
What will be the output ?