In python the ' STRING data type' can be defined as...?
  • holds alphanumeric text
  • hold whole numbers
  • holds numbers with a decimal point
  • holds either a true or false value
In python the ' INTEGER data type' can be defined as...?
  • holds alphanumeric data as text
  • holds whole numbers
  • holds numbers with a decimal point
  • holds either ‘true’ or ‘false’
In python the ' FLOAT data type' can be defined as...?
  • holds alphanumerical data
  • holds whole numbers
  • holds a decimal point in a number
  • hold either true or false
In python the ' BOOLEAN data type' can be defined as...?
  • holds alphanumerical data
  • holds whole numbers
  • holds a number with a decimal point
  • holds either true or false
What is the correct definition for a VARIABLE?
  • a changeable value, such as a score in a computer game.
  • a value that cannot be changed
What data type would be used for storing someone's telephone numbers?
  • Float (using a decimal point)
  • Integer (just whole numbers)
  • String (alphanumerical data)
If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?
  • String (alphanumerical)
  • Float (decimal point)
  • Boolean (true or false)
What is the correct definition for 'pseudo code?'
  • a notation resembling a complex programming language, used in program design.
  • a notation resembling a simplified programming language, used in program design.
What is the function of the code:amount = int(input("Enter a conversion into pounds:))currency = input ("press 1 for indian rupees, 2 for Chinese yuan or 0 to exit:")
  • to find the total amount of currency altogether
  • to calculate and convert the exchange rates.
what is the code for a STRING in python?
  • str
  • stri
  • stg
what is correct code for INTEGER in python?
  • in
  • ing
  • int
What is the output from the following code?print ("hello world")
  • Hello World
  • hello world
  • print hello world
What best defines an IF statement in python?
  • Is an embedded string with a variable
  • An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
  • “You are aged to perfection!”
  • "Wow, you are half a century old!"
  • "You are a spring chicken!"
I am 18 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
  • "You are aged to perfection"
  • "Wow, you are half a century old!"
  • "You are spring chicken!"
Is Python a Case Sensitive Language?
  • Yes
  • No
  • May not be
  • None of the above
Which of the following is a invalid variable in Python
  • _a=1
  • __a=1
  • _str_=1
  • None of the above
What is answer of this expression, 22 % 3 is?
  • 7
  • 1
  • 0
  • 5
Mathematical operations can be performed on a string.
  • True
  • False
  • May not be
  • None of the above
What is the output of the following?x = ['ab', 'cd']for i in x:i.upper()print(x)
  • [‘ab’, ‘cd’].
  • [‘AB’, ‘CD’].
  • None of the above
  • [None, None]
What is the output of the following?i = 1while True:if i%2 == 0:breakprint(i)i += 2
  • 1
  • 1 2
  • 1 2 3 4 5 6...
  • 1 3 5 7 9 11....
What is the output of the following?i = 0while i < 5: print(i) i += 1 if i == 3: breakelse: print(0)
  • 0 1 2 0
  • 0 1 2
  • error
  • none of the mentioned
What is the output of the following?x = 'abcd'for i in range(x): print(i)
  • a b c d
  • 1 2 3 4
  • error
  • None of the above
What is the output of the following?for i in range(10): if i == 5: break else: print(i)else: print("Here")
  • 0 1 2 3 4 Here
  • 0 1 2 3 4 5 Here
  • 0 1 2 3 4
  • 1 2 3 4 5
What is the output when following statement is executed ?>>>"a"+"bc"
  • a
  • bc
  • ac
  • abc
What is the output when following statement is executed ?>>>"abcd"[2:]
  • a
  • ab
  • ac
  • cd
What is the output when following code is executed ?>>> str1 = 'hello' >>> str2 = ',' >>> str3 = 'world' >>> str1[-1:]
  • olleh
  • hello
  • h
  • o
What is the output of the following code ?>>>example = "snow world" >>>example[3] = 's'>>>print example
  • snow
  • snow world
  • error
  • snos world
Which of the following commands will create a list? a) list1 = list() b) list1 = []. c) list1 = list([1, 2, 3]) d) all of the mentioned
  • list1 = list()
  • list1 = [].
  • list1 = list([1, 2, 3])
  • all of the mentioned
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1) ?
  • 3
  • 5
  • 1
  • 25
Suppose list1 is [1, 5, 9], what is sum(list1) ?
  • 1
  • 9
  • 15
  • none
What will be the output?names1 = ['Amir', 'Bala', 'Chales']if 'amir' in names1: print(1) else: print(2)
  • None
  • 1
  • 2
  • error
Which of the following is a Python tuple?
  • [1, 2, 3].
  • (1, 2, 3)
  • {1, 2, 3},
  • {},
What will be the output?>>>t=(1,2,4,3) >>>t[1:3]
  • (1,2)
  • (1,2,4)
  • (2,4)
  • (2,4,3)
What is the output of the following code?nums = set([1,1,2,3,3,3,4,4])print(len(nums))
  • 7
  • error
  • 4
  • 8
Which of the following statements create a dictionary?
  • d = {},
  • d = {“john”:40, “peter”:45},
  • d = {40:”john”, 45:”peter”},
  • All of the mentioned
Read the code shown below carefully and pick out the keys?d = {"john":40, "peter":45},
  • “john”, 40, 45, and “peter”
  • “john” and “peter”
  • 40 and 45
  • None
What is the output of the expression:round(4.576)
  • 4.5
  • 4
  • 5
  • 4.576
Which of the following functions is a built-in function in python?
  • seed()
  • sqrt()
  • factorial()
  • print()
_____ represents an entity in the real world with its identity and behaviour
  • a method
  • a object
  • a class
  • a operator
Which character is used in Python to make a comment?
  • /
  • //
  • #
  • !
Stores a piece of data, and gives it a specific name
  • variable
  • whitespace
  • interpreter
  • modulus
A Python statement won't try to run as code by a machine
  • comment
  • modulus
  • variable
  • boolean
What does this function do? input()
  • Opens the CD tray.
  • Asks the user to type something in.
  • Displays the word 'input'.
  • Exits the program.
What code would you use to get an average of your maths and English test results?
  • Average = (Maths+English)/2
  • Average = Maths+English/2
  • Average = (Maths+English)*2
  • Average = Maths+English*2
True or False:Python can be used to make games and phone apps.
  • True
  • False
Guess the output:a = 255b = 255a == b
  • True
  • False
What is an integer?
  • A number with a decimal point.
  • A whole number.
  • An array of characters.
  • A single character.
Which one of these is floor division?
  • /
  • //
  • %
  • none of the above
The expression Int(x) implies that the variable x is converted to integer.
  • True
  • False
  • both
  • None of above
Which of the following words cannot be a variable in python language?
  • _abc
  • abc
  • 9abc
  • ABC
What does this code do? print("Hello world!")
  • Displays 'Hello world!' in the shell window.
  • Sends 'Hello world!' to the printer.
  • Waits for the user to type in 'Hello world!'
  • Displays 'hello, world.' in the shell window.
What symbol do you type in to add a short comment?
  • """
  • #
  • @
  • /
True or False:phone.number is a good name for a variable.
  • True
  • False
True or False:5.0 is an example of the 'float' datatype.
  • True
  • False
You write a program where the user types how many apples they want to buy. The program calculates the total cost and displays it on the screen in pounds. What is the output?
  • numberOfApples (integer)
  • totalPrice = numberOfApples*25/100
  • totalPrice (float)
  • totalPrice = numberOfApples
What is the process of converting one datatype to another called?
  • Data conversion.
  • Type Casting.
  • Type Conversion.
  • Concatenation.
Gjdk is not a good name for a variable, why?
  • It starts with a capital letter.
  • It does not contain any spaces.
  • There are no vowels.
  • It's meaningless.
True or False:You need to convert an integer to a string before you can use it in the print() function.
  • True
  • False
In this code, how much does an apple cost?
cs-2 sb-1-Python Quizimg_no 551.jpg
  • £1
  • 50p
  • 20p
  • 25p
True or False:There are no symbols which can be used in a variable name.
  • True
  • False
What function converts the data in a variable into a 'float'?
  • int()
  • flt()
  • bool()
  • float()
Comments are used to make code easier to read.
  • True
  • False
Variable names can start with...
  • ...only capital letters.
  • ...any number, letter or an underscore (_).
  • ...any letter or symbol.
  • ...any letter or an underscore (_).
You are asked to write a program where the user types in the amount of marks they got for a paper with 70 marks. The program then calculates and displays their score as a percentage. What is the process?
  • marks (integer)
  • percentage (float)
  • percentage = marks/100*70
  • percentage = marks/70*100
What would the program display if you ran this code and entered 2 and then 3 when prompted?
cs-2 sb-1-Python Quizimg_no 552.jpg
  • The total is 5.
  • The total is 23.
  • The total is 6.
  • An error.
x = 8print(x > 3 or x < 20)
  • True
  • False
Which python operator means 'less than or equal to'?
  • >=
  • >
  • <
  • <=
<=
  • less than
  • less than or equal to
>=
  • greater than
  • greater than or equal to
  • not greater than
  • not equal to
==
  • equal to
  • assign a variable
  • not equal to
  • less than
! =
  • greater than variable
  • less than variable
  • equal to
  • not equal to
6 > 5
  • TRUE
  • FALSE
3<=4
  • TRUE
  • FALSE
2 = = 3
  • TRUE
  • FALSE
45 ! = 2
  • TRUE
  • FALSE
Which operator would you use to assign a value to a variable?
  • =
  • ==
Which operator would you use to test a value is equal to another?
  • ==
  • =
Choose the correct Python code.Display: Welcome to the quiz!
  • print ("Welcome to the quiz!")
  • print (Welcome to the quiz!)
x = 5print(x > 3 and x < 10)
  • True
  • False
x = 10print(x > 3 and x < 9)
  • True
  • False
x = 14print(x > 10 or x < 3)
  • True
  • False
x = 5print(x < 2 or x < 3)
  • True
  • False
x = 5print(not(x > 3 and x < 10))
  • True
  • False
x = 5print(not(x > 6 or x < 3 ))
  • True
  • False
x = 7print(x > 8 and x < 10)
  • True
  • False
x = 100print(x < 10 or x < 80)
  • True
  • False
Which data type is used to store:100
  • Integer
  • Double
  • Boolean
  • String
This data type is used to store whole numbers
  • Integer
  • Double
  • Boolean
  • String
This data type is used to store a mixture of letters and numbers and symbols.
  • String
  • Character
  • Boolean
  • Integer
A variable is a named value that can be changed in the program.
  • False
  • True
What is an Integer?
  • A data type that contains whole numbers. eg: 3, 45, 124
  • Numbers with decimal point. eg: 0.5, 2.45, 56.04
  • Group of characters between quotation marks. eg: "dog"
  • Data type that can only be True or False.
What is a Float?
  • A data type that contains whole numbers. eg: 3, 45, 124
  • Numbers with decimal point. eg: 0.5, 2.45, 56.04
  • Group of characters between quotation marks. eg: "dog"
  • Data type that can only be True or False.
What is a Boolean?
  • A data type that contains whole numbers. eg: 3, 45, 124
  • Numbers with decimal point. eg: 0.5, 2.45, 56.04
  • Group of characters between quotation marks. eg: "dog"
  • Data type that can only be True or False.
Which data type is used to store:TRUE
  • Boolean
  • Double
  • String
  • Integer
What will be the output?name = 'Dave'print (name)
  • Dave
  • 'Dave'
  • name
  • (name)
Syntax is...
  • the word used to describe an error
  • is is used to read information
  • the rules of the programming language
  • it is used to output informaiton
A variable is...
  • a storage location
  • a storage location that uses a symbolic name to store a value
  • a storage location that uses mnemonic devices to hold a place on the hard drive for retrieval later
What type of loop could we use to make a square?
  • For
  • Four
  • While
  • If Else
What is iteration?
  • Repeating an instruction 5 times
  • Code
  • Repeating an instruction an unlimited number of times
  • Repeating an instruction until a goal is met
To make a comment in the code (that is not interpreted) use the following symbol:
  • *
  • /
  • {},
  • #
When creating a "for" loop, the character that must appear at the end of "for i in range (4)" is which of the following:
  • ;
  • },
  • )
  • :
Find the error in the following code:wn = Turtle.Screen()
  • Alignment
  • Syntax (Capitalization)
  • Attribution Error
  • Unassigned Variable
The following code creates a...
cs-2 sb-1-Python Quizimg_no 887.jpg
  • polygon
  • parallelogram
  • diamond
  • rectangle
The following code creates a...
cs-2 sb-1-Python Quizimg_no 888.jpg
  • polygon
  • parallelogram
  • diamond
  • rectangle
0:0:1



Answered

Not Answered

Not Visited
Correct : 0
Incorrect : 0