Python IITU 2017

Descrição

Final questions
YouTube Channel
Quiz por YouTube Channel, atualizado more than 1 year ago
YouTube Channel
Criado por YouTube Channel mais de 6 anos atrás
101
0

Resumo de Recurso

Questão 1

Questão
1. What is the output of print str if str = 'Hello World!'?
Responda
  • Hello World
  • Hello World!
  • World
  • ‘Hello World!’

Questão 2

Questão
What is the output of print str * 2 if str = 'Hello World!'?
Responda
  • Hello World
  • Hello World! Hello World!
  • World
  • ‘Hello World! Hello World

Questão 3

Questão
Which of the following is correct about dictionaries in python?
Responda
  • 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

Questão 4

Questão
What is the output of print tinylist * 2 if tinylist = [123, 'john']?
Responda
  • [123, ‘john’, 123, ‘john’]
  • [123, 'john'] * 2
  • Error
  • [123, 'john']

Questão 5

Questão
What is the output of print str[2:] if str = 'Hello World!'?
Responda
  • llo World!
  • H
  • llo
  • Hello World!

Questão 6

Questão
What is the output of len([1, 2, 3])?
Responda
  • 1
  • 2
  • 3
  • 4

Questão 7

Questão
What is the output of print str * 2 if str = 'Hello World!'?
Responda
  • Hello World!Hello World!
  • Hello World! * 2
  • error
  • 2

Questão 8

Questão
Which of the following function convert an integer to a character in python?
Responda
  • set(x)
  • dict(d)
  • frozenset(s)
  • chr(x)

Questão 9

Questão
Which of the following function checks in a string that all characters are in lowercase?
Responda
  • islower()
  • isnumeric()
  • isspace()
  • istitle()

Questão 10

Questão
Which of the following function returns the max alphabetical character from the string str?
Responda
  • lower()
  • lstrip()
  • max(str)
  • min(str)

Questão 11

Questão
Which of the following is correct about Python?
Responda
  • 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

Questão 12

Questão
What is the output of L[1:] if L = [1,2,3]?
Responda
  • 2,3
  • 2
  • 3
  • None of the above.

Questão 13

Questão
What is the output of L[-2] if L = [1,2,3]?
Responda
  • 1
  • 2
  • 3
  • -2

Questão 14

Questão
What is the following function sorts a list?
Responda
  • list.reverse()
  • list.sort()
  • list.pop(obj=list[-1])
  • list.remove(obj)

Questão 15

Questão
State the output that would be produced from the following statement, when written in Python code: print “3”+”3”
Responda
  • 33
  • 3
  • 6
  • 333

Questão 16

Questão
State the output that would be produced from the following statement, when written in Python code: print 3+3
Responda
  • 33
  • 3
  • 6
  • 333

Questão 17

Questão
State the output that would be produced from the following statement, when written in Python code: print “3” * 3
Responda
  • 33
  • 3+3
  • 6
  • 333

Questão 18

Questão
What is the output of print str[2:5] if str = 'Hello World!'?
Responda
  • llo World!
  • H
  • llo
  • None of the above.

Questão 19

Questão
Which of the following function converts a string to all uppercase?
Responda
  • upper()
  • isdecimal()
  • swapcase()
  • title()

Questão 20

Questão
Which of the following function converts a string to all lowercase?
Responda
  • upper()
  • isdecimal()
  • lower()
  • title()

Questão 21

Questão
Functions must be defined first ____________ they can be called
Responda
  • Before
  • After
  • Between
  • At the same time

Questão 22

Questão
What is the output of for x in [1, 2, 3]: print x?
Responda
  • X x x
  • 1 2 3
  • Error
  • 1,2,3

Questão 23

Questão
What is the output when following statement is executed print “a”+ “bc” ?
Responda
  • A
  • a
  • abc
  • bc

Questão 24

Questão
What is the output when we execute print (list("hello"))?
Responda
  • [‘h’, ’e’, ’l’, ‘l’, ‘o’]
  • [‘hello’]
  • [‘llo’]
  • {‘hello’}

Questão 25

Questão
What is the output from the following code str1="helloworld", str1[::-1]?
Responda
  • dlrowolleh
  • hello
  • world
  • helloworld

Questão 26

Questão
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
Responda
  • [2, 33, 222, 14]
  • Error
  • 25
  • [25, 14, 222, 33, 2]

Questão 27

Questão
Which of the following is a Python tuple?
Responda
  • [1, 2, 3]
  • (1, 2 ,3)
  • {1, 2, 3}
  • {}

Questão 28

Questão
Is Python case sensitive when dealing with identifiers?
Responda
  • Yes
  • No

Questão 29

Questão
Which of the following cannot be a variable?
Responda
  • __init__
  • in
  • it
  • on

Questão 30

Questão
Supports ‘Last in, first out’ ordering of data
Responda
  • Queue
  • Stack
  • Tuple
  • Dictionary

Questão 31

Questão
Which of the following is correct output of “print type(1/2)”?
Responda
  • <type 'int'>.
  • <type 'number'>
  • <type 'float'>
  • <type 'double'>
  • <type 'tuple'>

Questão 32

Questão
Which of the following is correct output of “print type([1,2])”?
Responda
  • <type 'list'>
  • <type 'number'>
  • <type 'float'>
  • <type 'double'>
  • <type 'tuple'>

Questão 33

Questão
Which of the following is correct output of “import math print(math.floor(5.6))”?
Responda
  • 6
  • 5.5
  • 5.0
  • 5

Questão 34

Questão
Which of the following is correct output of “colors = [‘Red’, ‘Black’, ‘White’, ‘Green’] x = colors.index(“White”) print(x)”?
Responda
  • 2
  • 3
  • 1
  • 4

Questão 35

Questão
Which of the following is correct output of “x = 12 y = 18 x = y y = x print(x,y)”?
Responda
  • 12 18
  • 18 18
  • 12 12
  • 18 12

Questão 36

Questão
Which of the following is correct output of “x = ‘abcd’ y = 10 print(x+y)”?
Responda
  • 10
  • abcd10
  • abcd
  • 10abcd

Questão 37

Questão
Which of the following is correct output of “colors = [‘Red’, ‘Black’, ‘White’, ‘Green’] print(colors[-2][-2])”?
Responda
  • n
  • en
  • c
  • t

Questão 38

Questão
Which of the following statement is Python comment?
Responda
  • *This is a Python comment
  • #This Is a Python comment
  • none of the above
  • //This is a Python comment

Questão 39

Questão
Which of the following code will add a new color ‘Black’ at the end of the list?
Responda
  • colors.insert('black')
  • colors.add('black')
  • colors.append('black')
  • colors+=('black')

Questão 40

Questão
Which of the following expression is called for an user input?
Responda
  • input
  • read
  • none of the above
  • for

Questão 41

Questão
Which of the following is correct output of “colors = [‘red’, ‘white’, ‘Blue’, ‘green’] print(colors[-2])?
Responda
  • 'white'
  • 'blue'
  • 'red'
  • 'green'

Questão 42

Questão
Which of the following is correct output of “print(type([1,2,3]))”?
Responda
  • <class 'list'>
  • <class 'tuple'>
  • <class 'set'>
  • <class 'type'>

Questão 43

Questão
Which of the following is correct about Python?
Responda
  • 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

Questão 44

Questão
Is python a case sensitive language?
Responda
  • True
  • False

Questão 45

Questão
Which of the following data types is not supported in python?
Responda
  • numbers
  • string
  • list
  • slice

Questão 46

Questão
Which of the following data types is not supported in python?
Responda
  • tuple
  • dictionary
  • generics
  • list

Questão 47

Questão
What is the output of print str if str = 'Hello World!'?
Responda
  • Hello World!
  • error
  • str
  • none of the above

Questão 48

Questão
What is the output of print str[0] if str = 'Hello World!'?
Responda
  • Hello World!
  • H
  • ello World!
  • str

Questão 49

Questão
What is the output of print str[2:5] if str = 'Hello World!'?
Responda
  • Hello World!
  • llo World!
  • H
  • llo

Questão 50

Questão
_________________ in Python are identified as a contiguous set of characters in between quotation marks
Responda
  • numbers
  • strings
  • list
  • tuple

Questão 51

Questão
What is the output of print list if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Responda
  • [ 'abcd', 786, 2.23, 'john', 70.2]
  • list
  • error
  • [ 'abcd', 786, 2.23, 'john']

Questão 52

Questão
What is the output of print list[0] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Responda
  • [ 'abcd', 786, 2.23, 'john', 70.2]
  • list
  • error
  • [ 'abcd']

Questão 53

Questão
What is the output of print list[1:3] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Responda
  • [ 'abcd', 786, 2.23, 'john', 70.2]
  • list
  • [786, 2.23, 'john']
  • [ 'abcd']

Questão 54

Questão
What is the output of print list[2:] if list = [ 'abcd', 786, 2.23, 'john', 70.2]?
Responda
  • [ 'abcd', 786, 2.23, 'john', 70.2]
  • [786, 2.23, 'john', 70.2]
  • [2.23, 'john', 70.2]
  • [ 'abcd']

Questão 55

Questão
What is the output of print tinylist * 2 if tinylist = [123, 'john']?
Responda
  • [123, 'john', 123, 'john']
  • [123, 'john'] * 2
  • Error
  • [123]

Questão 56

Questão
Which of the following operator in python performs exponential (power) calculation on operands?
Responda
  • **
  • //
  • is
  • not in

Questão 57

Questão
Which of the following function changes case for all letters in string?
Responda
  • swap(old, new [, max])
  • strip([chars])
  • swapcase().
  • title()

Questão 58

Questão
What is the output of ['Hi!'] * 4?
Responda
  • ['Hi!', 'Hi!', 'Hi!', 'Hi!']
  • ['Hi!'] * 4
  • Error
  • none of the above

Questão 59

Questão
What is the following function sorts a list?
Responda
  • list.reverse()
  • list.sort([func])
  • list.pop(obj=list[-1])
  • list.remove(obj)

Questão 60

Questão
Following set of commands are executed in shell, what will be the output? >>>str="Hello" >>>str[:2]
Responda
  • He
  • lo
  • olleh
  • hello

Questão 61

Questão
What kind of error occurs when you execute the following code apple = mango?
Responda
  • Syntaxerror
  • Nameerror
  • Valueerror
  • Typeerror

Questão 62

Questão
Select all options that will correctly print “hello-how-are-you”?
Responda
  • print(‘hello’, ‘how’, ‘are’, ‘you’)
  • print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
  • print(‘hello-‘ + ‘how-are-you’)
  • print(‘hello’, ‘how’, ‘are’)

Questão 63

Questão
What is the answer of this expression, 22 % 3?
Responda
  • 7
  • 1
  • 0
  • 5

Questão 64

Questão
You can’t perform mathematical operation on String?
Responda
  • True
  • False

Questão 65

Questão
Operators with the same precedence are evaluated in which manner?
Responda
  • left to right
  • right to left

Questão 66

Questão
How will you get ‘min’ alphabetical character from the string?
Responda
  • min(str)
  • max(str)
  • min(int)
  • lower()

Questão 67

Questão
How will you get ‘max’ alphabetical character from the string?
Responda
  • min(str)
  • max(str)
  • min(int)
  • lower()

Questão 68

Questão
How will you convert a string to all lowercase?
Responda
  • min(str)
  • max(str)
  • min(int)
  • lower()

Questão 69

Questão
Which of the following is invalid?
Responda
  • _a = 1
  • __a = 1
  • __str__ = 1
  • a% = 1

Questão 70

Questão
Which of the following is an invalid variable?
Responda
  • my_string_1
  • 1st_string
  • foo
  • alua

Questão 71

Questão
Why are local variable names beginning with an underscore discouraged?
Responda
  • 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

Questão 72

Questão
Which of the following is not a keyword?
Responda
  • eval
  • assert
  • nonlocal
  • pass

Questão 73

Questão
All keywords in Python are in
Responda
  • lower case
  • upper case
  • Capitalized
  • none

Questão 74

Questão
Which of the following is true for variable names in Python?
Responda
  • Unlimited length
  • All private members must have leading and trailing underscores
  • Underscore and ampersand are the only two special characters allowed
  • none

Questão 75

Questão
Which of the following is an invalid statement?
Responda
  • abc = 1,000,000
  • a b c = 1000.2000.3000
  • a,b,c = 1000, 2000, 3000
  • a_b_c = 1,000,000

Questão 76

Questão
Which of the following cannot be a variable?
Responda
  • __init__
  • in
  • it
  • on

Questão 77

Questão
What does the function re.match do?
Responda
  • 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

Questão 78

Questão
Which of the following is incorrect?
Responda
  • float(‘inf’)
  • float(‘nan’)
  • float(’56’+’78’)
  • float(’12+34′)

Questão 79

Questão
Int(x) means variable x is converted to integer
Responda
  • True
  • False

Questão 80

Questão
Can You perform mathematical operation with String?
Responda
  • Yes
  • No
  • None
  • Both

Questão 81

Questão
Which of the following logical operator is correct for definition “If both the operands are true then then condition becomes true”
Responda
  • And
  • No correct answer
  • Not
  • In

Questão 82

Questão
Which of the following logical operator is correct for definition “If both the operands are false then then condition becomes true”
Responda
  • And
  • No correct answer
  • Not
  • OR

Questão 83

Questão
Which of the following logical operator is correct for definition “If one of the operands is false, second is true then condition becomes false”
Responda
  • And
  • No correct answer
  • IN
  • OR

Questão 84

Questão
Which of the following logical operator is correct for definition “If one of the operands is false, second is true then condition becomes true”
Responda
  • And
  • No correct answer
  • IN
  • OR

Questão 85

Questão
Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true
Responda
  • >
  • <
  • >=
  • <=

Questão 86

Questão
Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true
Responda
  • >
  • <
  • >=
  • <=

Questão 87

Questão
Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true
Responda
  • >
  • <
  • >=
  • <=

Questão 88

Questão
Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true
Responda
  • >
  • <
  • >=
  • <=

Questão 89

Questão
Choose the correct expressing computations definition for “Get data from the keyboard, a file, or some other device”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 90

Questão
Choose the correct expressing computations definition for “Display data on the screen or send data to a file or other device”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 91

Questão
Choose the correct expressing computations definition for “Perform basic mathematical operations like addition and multiplication”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 92

Questão
Choose the correct expressing computations definition for “Check for certain conditions and execute the appropriate code”
Responda
  • Input
  • Output
  • Conditional logic
  • Repetition

Questão 93

Questão
Choose the correct expressing computations definition for “Perform some action repeatedly, usually with some variation”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 94

Questão
Choose the correct definition for High level code
Responda
  • Syntax a specific type of computer can understand
  • Also known as Assembly or Machine Code
  • Rare to directly create now
  • Human friendly syntax

Questão 95

Questão
_________________is a name that refers to a value
Responda
  • Variable
  • Name
  • Value
  • Nothing

Questão 96

Questão
_______________________is used to create variables and to give them values
Responda
  • Assignment statement
  • Variable
  • Naming
  • Statement

Questão 97

Questão
We can use the ______________ function to check the type of a variable
Responda
  • Type()
  • Check()
  • Variable()
  • Str()

Questão 98

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a string”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 99

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a integer”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 100

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a float”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 101

Questão
Choose the keyword that cannot be used as names for variables as they already have a meaning and purpose.
Responda
  • def
  • definition
  • purpose
  • printing

Questão 102

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “index starts at 0”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 103

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “reversing from the last value”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 104

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “subset of the values”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 105

Questão
in python we use data type, that has keys with values called?
Responda
  • Lists
  • Dictionaries
  • Dairies
  • Compounds

Questão 106

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print everything from the dictionary?
Responda
  • print numbers
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 107

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print dictionary keys?
Responda
  • print numbers
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 108

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print Alex’s telephone number?
Responda
  • print numbers[‘alex’]
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 109

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary key?
Responda
  • ‘john’
  • 756
  • 'alua’
  • numbers.keys

Questão 110

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary value?
Responda
  • ‘john’
  • 756
  • ‘456’
  • numbers.keys

Questão 111

Questão
choose the correct definition for ‘syntax error’
Responda
  • 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

Questão 112

Questão
choose the correct definition for ‘type error’
Responda
  • 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

Questão 113

Questão
choose the correct definition for ‘name error’
Responda
  • 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

Questão 114

Questão
Functions must be defined ___________ they can be called?
Responda
  • After
  • Before
  • Instead
  • With def keyword

Questão 115

Questão
Which of the following is the use of function in python?
Responda
  • 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

Questão 116

Questão
Which keyword is use for function?
Responda
  • Fun
  • Define
  • Def
  • Function

Questão 117

Questão
What is the output of the below program ?
Responda
  • Hello World! Hello World!
  • ‘Hello World!’ ‘Hello World!’
  • Hello Hello
  • None of the mentioned

Questão 118

Questão
What is the output of the below program ?
Responda
  • 3
  • 4
  • 4 is maximum
  • 3 is maximum

Questão 119

Questão
What is the output of the below program ?
Responda
  • 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

Questão 120

Questão
Which are the advantages of functions in python?
Responda
  • Reducing duplication of code
  • Decomposing complex problems into simpler pieces
  • Improving clarity of the code
  • All of the mentioned

Questão 121

Questão
What are the two types of functions?
Responda
  • Custom function and Built-in function
  • Built-in function and User-Defined function
  • Custom function and System function
  • System function and User-Defined function

Questão 122

Questão
Where is function defined?
Responda
  • Module
  • Class
  • Another function
  • All of the mentioned

Questão 123

Questão
What is the output of below program ?
Responda
  • 3
  • 9
  • 27
  • 333

Questão 124

Questão
What is the output of below program ?
Responda
  • 432
  • 230400
  • 24000
  • 430

Questão 125

Questão
What are the keys? for d = {"john":40, "peter":45}
Responda
  • “john”, 40, 45, and “peter”
  • “john” and “peter”
  • 40 and 45
  • d = (40:”john”, 45:”peter”)

Questão 126

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 127

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 128

Questão
What will be the output
Responda
  • True
  • False
  • Error
  • None

Questão 129

Questão
What is the output for code? >> d = {"john":40, "peter":45} >> d["john"]
Responda
  • 40
  • 45
  • John 40
  • Peter 45

Questão 130

Questão
Suppose d = {“john”:40, “peter”:45}, what happens when retieving a value using d[“susan”]?
Responda
  • 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.

Questão 131

Questão
Choose the correct expressing computations definition for “Display data on the screen or send data to a file or other device”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 132

Questão
Choose the correct expressing computations definition for “Perform basic mathematical operations like addition and multiplication”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 133

Questão
Choose the correct expressing computations definition for “Check for certain conditions and execute the appropriate code”
Responda
  • Input
  • Output
  • Conditional logic
  • Repetition

Questão 134

Questão
Choose the correct expressing computations definition for “Perform some action repeatedly, usually with some variation”
Responda
  • Input
  • Output
  • Maths
  • Repetition

Questão 135

Questão
Choose the correct definition for High level code
Responda
  • Syntax a specific type of computer can understand
  • Also known as Assembly or Machine Code
  • Rare to directly create now
  • Human friendly syntax

Questão 136

Questão
_________________is a name that refers to a value
Responda
  • Variable
  • Name
  • Value
  • Nothing

Questão 137

Questão
_______________________is used to create variables and to give them values
Responda
  • Assignment statement
  • Variable
  • Naming
  • Statement

Questão 138

Questão
We can use the ______________ function to check the type of a variable
Responda
  • Type()
  • Check()
  • Variable()
  • Str()

Questão 139

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a string”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 140

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a integer”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 141

Questão
We can alter the type of a variable using the following functions, which is “converts variable to a float”
Responda
  • Type()
  • Int()
  • Float()
  • Str()

Questão 142

Questão
Choose the keyword that cannot be used as names for variables as they already have a meaning and purpose.
Responda
  • def
  • definition
  • purpose
  • printing

Questão 143

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “index starts at 0”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 144

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “reversing from the last value”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 145

Questão
Lists are a commonly used, simple compound data type in Python, choose the correct answer for “subset of the values”
Responda
  • mylist[0]
  • mylist[-1]
  • mylist[2:4]
  • mylist[1]

Questão 146

Questão
in python we use data type, that has keys with values called?
Responda
  • Lists
  • Dictionaries
  • Dairies
  • Compounds

Questão 147

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print everything from the dictionary?
Responda
  • print numbers
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 148

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print dictionary keys?
Responda
  • print numbers
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 149

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, how to print Alex’s telephone number?
Responda
  • print numbers[‘alex’]
  • telnumbers
  • telnumbers[‘alex’]
  • telnumbers.keys()

Questão 150

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary key?
Responda
  • ‘john’
  • 756
  • ‘alua’
  • numbers.keys

Questão 151

Questão
There is dictionary called telnumbers = {‘john’: 756, ‘mike’: 789, ‘alex’: 456, ‘sue’: 123}, which of the following is the dictionary value?
Responda
  • ‘john’
  • 756
  • ‘456’
  • numbers.keys

Questão 152

Questão
choose the correct definition for ‘syntax error’
Responda
  • 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

Questão 153

Questão
choose the correct definition for ‘type error’
Responda
  • 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

Questão 154

Questão
choose the correct definition for ‘name error’
Responda
  • 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

Questão 155

Questão
Functions must be defined ___________ they can be called?
Responda
  • After
  • Before
  • Instead
  • With def keyword

Questão 156

Questão
Which of the following is the use of function in python?
Responda
  • 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

Questão 157

Questão
Which keyword is use for function?
Responda
  • Fun
  • Define
  • Def
  • Function

Questão 158

Questão
What is the output of the below program ?
Responda
  • Hello World! Hello World!
  • ‘Hello World!’ ‘Hello World!’
  • Hello Hello
  • None of the mentioned

Questão 159

Questão
What is the output of the below program ?
Responda
  • 3
  • 4
  • 4 is maximum
  • 3 is maximum

Questão 160

Questão
What is the output of the below program ?
Responda
  • 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

Questão 161

Questão
Which are the advantages of functions in python?
Responda
  • Reducing duplication of code
  • Decomposing complex problems into simpler pieces
  • Improving clarity of the code
  • All of the mentioned

Questão 162

Questão
What are the two types of functions?
Responda
  • Custom function and Built-in function
  • Built-in function and User-Defined function
  • Custom function and System function
  • System function and User-Defined function

Questão 163

Questão
Where is function defined?
Responda
  • Module
  • Class
  • Another function
  • All of the mentioned

Questão 164

Questão
What is the output of below program ?
Responda
  • 3
  • 9
  • 27
  • 333

Questão 165

Questão
What is the output of below program ?
Responda
  • 432
  • 230400
  • 24000
  • 430

Questão 166

Questão
What are the keys? for d = {"john":40, "peter":45}
Responda
  • “john”, 40, 45, and “peter”
  • “john” and “peter”
  • 40 and 45
  • d = (40:”john”, 45:”peter”)

Questão 167

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 168

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 169

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 170

Questão
What is the output for code? >> d = {"john":40, "peter":45} >> d["john"]
Responda
  • 40
  • 45
  • John 40
  • Peter 45

Questão 171

Questão
Suppose d = {“john”:40, “peter”:45}, what happens when retieving a value using d[“susan”]?
Responda
  • 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.

Questão 172

Questão
What is the output of the below program ?
Responda
  • 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

Questão 173

Questão
Which are the advantages of functions in python?
Responda
  • Reducing duplication of code
  • Decomposing complex problems into simpler pieces
  • Improving clarity of the code
  • All of the mentioned

Questão 174

Questão
What are the two types of functions?
Responda
  • Custom function and Built-in function
  • Built-in function and User-Defined function
  • Custom function and System function
  • System function and User-Defined function

Questão 175

Questão
Where is function defined?
Responda
  • Module
  • Class
  • Another function
  • All of the mentioned

Questão 176

Questão
What is the output of below program ?
Responda
  • 3
  • 9
  • 27
  • 333

Questão 177

Questão
What is the output of below program ?
Responda
  • 432
  • 230400
  • 24000
  • 430

Questão 178

Questão
What are the keys? for d = {"john":40, "peter":45}
Responda
  • “john”, 40, 45, and “peter”
  • “john” and “peter”
  • 40 and 45
  • d = (40:”john”, 45:”peter”)

Questão 179

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Questão 180

Questão
What will be the output ?
Responda
  • True
  • False
  • Error
  • None

Semelhante

Vocabulário Inglês Básico
Alessandra S.
8 Benefícios dos Mapas Mentais
Alessandra S.
Plano de Estudo Vestibular- Semana 1
Alessandra S.
Como estudar com eficiência
Alessandra S.
English General Quiz
Luiz Fernando
Leis de Newton
Guilherme Hayashida
Temas mais cobrados em Física
Marina Faria
GEOGRAFIA - GEOPOLITICA
neusamiotto
ANATOMIA
flavio.paulo
Inquérito Policial
cesar_basso
Pronomes
anginhayme