Playing as a guest? to earn XP and track your progress.
๐ Getting Started with Python Quiz
๐ Getting Started with Python
A set of step-by-step instructions given to a computer to perform a task is called a:
Bus
Program
Byte
Device
A program is a set of instructions that tells the computer what to do, step by step.
Which language is written only in 0s and 1s?
Machine language
Python
Assembly language
Java
Machine language uses binary (0s and 1s) and is understood directly by the computer.
Assembly language uses short words such as ADD and MOV. These words are called:
Bytes
Mnemonics
Literals
Keywords
Assembly language uses mnemonics โ short memory-aid words for machine instructions.
Machine language and assembly language are:
Markup languages
Natural languages
Low-level languages
High-level languages
Low-level languages are close to the machine and hard for humans to read.
Python, Java and C++ are:
Assembly languages
Machine languages
High-level languages
Low-level languages
High-level languages use English-like words and are easy for humans to read and write.
Which is an advantage of a high-level language?
It works only on one machine
It runs without translation
It is easy to read, write and understand
It is written in 0s and 1s
High-level languages are close to English, so programs are easier to write and fix.
A program written in a high-level language is called the:
Object code
Bytecode
Source code
Machine code
The program you write is the source code; its machine-language version is the object code.
Software that converts a program into machine language is called a:
Utility program
Browser
Device driver
Language translator
Assemblers, compilers and interpreters are language translators.
Which translator converts assembly language into machine language?
Compiler
Editor
Interpreter
Assembler
An assembler translates assembly language programs into machine language.
Which translator converts the WHOLE high-level program into machine language at once?
Compiler
Assembler
Loader
Interpreter
A compiler translates the entire program in one go and then lists all the errors.
Which translator translates and runs a program LINE BY LINE?
Compiler
Linker
Assembler
Interpreter
An interpreter translates and executes one line at a time and stops at the first error.
Python is mainly a(n) ________ language.
Compiled-only
Assembly
Interpreted
Machine
Python programs are run line by line by the Python interpreter.
Who created Python?
Dennis Ritchie
Charles Babbage
James Gosling
Guido van Rossum
Guido van Rossum created Python in the Netherlands.
In which year was Python first released?
1985
1971
2001
1991
Python was first released in 1991.
Python was named after:
The comedy show Monty Python's Flying Circus
A python snake
Its creator's pet
A Greek god
Guido van Rossum named it after the British comedy show Monty Python's Flying Circus.
Python is free and its source code is available to everyone. This means it is:
Shareware
Free and open source
Closed source
Proprietary
Python is free to download and use, and its code is open for anyone to see and improve.
A Python program written on Windows can run on Linux or macOS without changes. This feature is called:
Indentation
Dynamic typing
Case sensitivity
Portability (platform independence)
Python is portable โ the same program runs on different operating systems.
Python treats Marks and marks as two different names. This means Python is:
Case insensitive
Case sensitive
Compiled
Portable
In Python, uppercase and lowercase letters are different.
In Python we don't have to declare the type of a variable before using it. This is called:
Portability
Dynamic typing
Static typing
Compiling
Python decides the type of a variable from the value given to it while running.
Which of these is a LIMITATION of Python?
It is slower than compiled languages like C++
It has very few libraries
It is costly to buy
It is hard to read
Because Python is interpreted, it usually runs slower than compiled languages.
Which of these is NOT a feature of Python?
Programs must be compiled into an .exe before every run
Easy to learn
Huge standard library
Free and open source
Python is interpreted; it does not need to be compiled into an .exe before running.
Python is rarely used for which of these?
Making mobile apps
Machine learning
Web development
Data analysis
Python is weak in mobile app development; it is widely used in data, web and AI.
When Python finds an error in line 3 of a 5-line program, what happens?
Lines 1 and 2 run, then Python stops at line 3 with an error
Python skips line 3 and runs lines 4 and 5
No line runs
All 5 lines run
Python runs line by line, so it executes the lines before the error and stops at the error.
Behind the scenes, Python first converts your program into:
Assembly code
Bytecode
Binary images
HTML
Python turns the source code into bytecode, which is then run by the Python Virtual Machine.
PVM stands for:
Python Virtual Machine
Python Variable Memory
Python Visual Mode
Program Verification Module
The Python Virtual Machine runs the bytecode.
IDLE stands for:
Internal Development Language Engine
Integrated Debugging and Linking Environment
Integrated Development and Learning Environment
Interactive Design and Language Editor
IDLE is Python's built-in Integrated Development and Learning Environment.
What is the prompt shown in the Python Shell?
C:>
$
###
The Python Shell shows >>> when it is ready for a command.
In which mode does Python run each statement immediately after you press Enter?
Interactive mode
Script mode
Batch mode
Compile mode
In interactive mode, each statement typed at >>> runs at once.
Which is a disadvantage of interactive mode?
The statements cannot be saved for later use
It needs a compiler
It cannot do calculations
Results appear late
Code typed in interactive mode is lost when the Shell is closed.
In which mode do we write a whole program, save it and then run it?
Script mode
Interactive mode
Prompt mode
Shell mode
Script mode lets you write, save and re-run complete programs.
A Python program file is saved with which extension?
.txt
.py
.pyt
.pt
Python script files use the .py extension, for example marks.py.
Which key runs a program in the IDLE editor?
Esc
F12
F1
F5
Run โ Run Module, or the F5 key, runs the program saved in the editor.
In IDLE, which menu option runs a saved program?
Options โ Configure
Run โ Run Module
Edit โ Find
File โ Open
Run Module (F5) runs the program in the editor.
Which window in IDLE shows the >>> prompt?
Python Shell
Browser
Editor window
File manager
The Python Shell is the interactive window with the >>> prompt.
What is the output of:
print(5 + 3)Error
8
53
5 + 3
Without quotes, 5 + 3 is calculated and 8 is printed.
What is the output of:
print("5 + 3")5 + 3
53
8
Error
Inside quotes, 5 + 3 is just text and is printed as it is.
What is the output of:
print("Marks:", 90)Marks: 90
Marks:, 90
"Marks:" 90
Marks:90
print() puts a space between items separated by commas.
What is the output of:
print(10 * 3)103
10 * 3
30
13
10 * 3 is calculated as 30.
What is the output of:
print("Hi", "Ravi")HiRavi
Hi, Ravi
Hi Ravi
"Hi" "Ravi"
Comma-separated items are printed with one space between them.
What is the output of:
print(7 - 2, "apples")5apples
7 - 2 apples
Error
5 apples
7 - 2 is calculated as 5, then a space, then the text.
Which statement prints the text Hello correctly?
Print("Hello")
print("Hello")
print Hello
PRINT("Hello")
print is written in lowercase and text must be inside quotes.
What error does Print("Hi") give in Python?
TypeError
SyntaxError
NameError
No error
Python is case sensitive; Print is not defined, so NameError occurs.
Which symbol starts a comment in Python?
#
%
/*
//
Anything after # on a line is a comment and is ignored by Python.
What does Python do with a comment?
Runs it as code
Prints it
Ignores it while running the program
Shows an error
Comments are notes for humans; Python ignores them.
What is the output of:
print("Python") # my first programError
Python # my first program
Python
my first program
The part after # is a comment, so only Python is printed.
Text written inside quotes in a program is called a:
Keyword
Number
Comment
String
Text in quotes, like "Hello", is a string.
Can a string be written in single quotes in Python, like print('Hi')?
Yes, but only for numbers
No, only triple quotes work
Yes, single or double quotes both work
No, only double quotes work
Python accepts both 'Hi' and "Hi" as strings.
What is the output of:
print("2" + "3")23
Error
5
2 + 3
Both are strings, so + joins them into 23.
What will print() with nothing inside the brackets do?
Give an error
Print 0
Print a blank line
Print None
An empty print() just moves to the next line, printing a blank line.
Which error occurs in print("Hello) ?
No error
TypeError
SyntaxError
NameError
The closing quote is missing, so Python cannot understand the statement.
Which of the following is the correct way to write Python code in interactive mode?
Type 5 + 3 after the >>> prompt
Save the file first
Press F5 first
Type >>> 5 + 3 yourself
The >>> is shown by Python; you only type the statement after it.
A program that runs correctly on Windows but must be completely rewritten for Linux is NOT:
Portable
High-level
Case sensitive
Interpreted
A portable program runs on many platforms without change, like Python programs.
Which statement about a compiler and an interpreter is TRUE?
An interpreter translates the whole program at once
A compiler runs the program line by line
A compiler shows all errors after translating the whole program; an interpreter stops at the first error
Both translate line by line
A compiler works on the whole program; an interpreter works one line at a time.
Python's large collection of ready-made modules is called its:
Shell
Hardware
Standard library
Compiler
Python comes with a huge standard library of ready-to-use modules.
Which of these is a valid use of Python in real life?
Building websites
Artificial Intelligence
Data analysis
All of the above
Python is used in data science, web development, AI, automation and more.