Python Beginner
Total questions: 30
Instructor name: Yunis Garayev
Name:
Class:
[Link] is the word (command) used to display numbers and text on the screen?
a)input c)output
b)print d)command
[Link] is a variable?
a)Data type b)a type of memory c)A box(memory location) where you store values
d)a type of graphics
3.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
forward slash /
c)
plus +
d)
asterisk *
4.
What is the name of the programming language we are learning?
a)
Pie thin
b)
Python
c)
Scratch
d)
Scribble
5.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
name
c)
(name)
d)
'Dave'
6.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good morning name
b)
Good morning 'Dave'
c)
Good morning Dave
d)
Good morning + Dave
7.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Error finder
d)
Syntax finder
8.
Which of these would work as a piece of code?
a)
if answer == "Yes":
b)
if answer == "Yes"
c)
if answer = "yes":
d)
IF answer == "Yes":
9.
If you want more than one option for your code, what do you use (after if)?
a)
ifif
b)
elif
c)
else
10.
How do you display text?
a)
output
b)
input
c)
print
d)
variable
11.
What is python?
a)
DTP software
b)
Computer
c)
Spreadsheet software
d)
a programming language
12.
In the following expression which element is a comparison operator?
if a > b:
print(a)
a)
b)
c)
if
d)
>
13.
In Python an ELSE IF statement is represented as what?
a)
elif
b)
elsif
c)
elseif
d)
ifelse
14.
What is the meaning of the following comparison operator?
a>b
a)
Greater than or equal to
b)
Greater than
c)
Less than
d)
Not equal to
15.
What is the meaning of the following comparison operator?
a >= b
a)
Not equal to
b)
Equal to
c)
Less than or equal to
d)
Greater than or equal to
16.
What is the meaning of the following comparison operator?
a != b
a)
Equal to
b)
Less than or equal to
c)
Greater than
d)
Not equal to
17.
IF and ELSE are used when a program needs to make a what?
a)
Decision
b)
Repeat
c)
Output
d)
Change
18.
a)
You are rich!
b)
Get a job!
c)
You can buy some chocloate
d)
You almost have enough
Get a job!
19.
a)
You are rich
b)
You can buy some chocolate
c)
Get a job!
d)
You almost have enough
20.
a)
3, 1, 6, 7, 2, 4, 5
b)
3, 6, 1, 2, 4, 5, 7
c)
6, 3, 1, 2, 4, 5, 7
d)
3, 6, 2, 5, 1, 4, 7
21.
What is syntax?
a)
It is used to output information
b)
Syntax is the word used to describe a variable
c)
Syntax is the rules of the programming language
d)
This is used to read information
22.
What will the following code do:
print("What is your name?")
a)
Print your name to the screen
b)
Allow you to enter information
c)
Allow you to type in your name
d)
Display the words 'What is your name?' on the screen
23.
The following code is used to create a variable and store a value. Why will it NOT work?
my number = 36
a)
There variable name can't be called my number
b)
The variable can't store a number
c)
A variable name cannot have any spaces
d)
The equals symbol should be at the beginning of the line
24.
What is the output from the following code:
name = "Fred"
print("Hello " + name)
a)
HelloFred
b)
Hello Fred
c)
Hello name
d)
Name error
25.
The following variable contains some data. What is the data type that is being stored.
hobby = "football"
a)
Boolean
b)
String (Text)
c)
Float
d)
Integer
26.
What will the output be from the following code?
print("Hello world!" * 2)
a)
Hello world!Hello world!
b)
TypeError
c)
Hello world! * 2
d)
Hello world world!
27.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
print(3+4)
c)
d)
SyntaxError
28.
What will the output be from the following code?
print("Hello world!")
a)
print(Hello world!)
b)
SyntaxError
c)
"Hello world!"
d)
Hello world!
29.
What will the output be from the following code?
Print("Hello world!")
a)
"Hello world"
b)
Print(Hello world!)
c)
Hello world!
d)
NameError
30.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
print(Hello world!)
c)
Hello world
d)
SyntaxError