Exit Chapter 02 ยท ๐Ÿ Getting Started with Python โ€” Quiz

Playing as a guest? to earn XP and track your progress.

Question 1 of 55 0 correct so far

๐Ÿ Getting Started with Python Quiz

Q1.

A set of step-by-step instructions given to a computer to perform a task is called a:

Explanation

A program is a set of instructions that tells the computer what to do, step by step.

Q2.

Which language is written only in 0s and 1s?

Explanation

Machine language uses binary (0s and 1s) and is understood directly by the computer.

Q3.

Assembly language uses short words such as ADD and MOV. These words are called:

Explanation

Assembly language uses mnemonics โ€” short memory-aid words for machine instructions.

Q4.

Machine language and assembly language are:

Explanation

Low-level languages are close to the machine and hard for humans to read.

Q5.

Python, Java and C++ are:

Explanation

High-level languages use English-like words and are easy for humans to read and write.

Q6.

Which is an advantage of a high-level language?

Explanation

High-level languages are close to English, so programs are easier to write and fix.

Q7.

A program written in a high-level language is called the:

Explanation

The program you write is the source code; its machine-language version is the object code.

Q8.

Software that converts a program into machine language is called a:

Explanation

Assemblers, compilers and interpreters are language translators.

Q9.

Which translator converts assembly language into machine language?

Explanation

An assembler translates assembly language programs into machine language.

Q10.

Which translator converts the WHOLE high-level program into machine language at once?

Explanation

A compiler translates the entire program in one go and then lists all the errors.

Q11.

Which translator translates and runs a program LINE BY LINE?

Explanation

An interpreter translates and executes one line at a time and stops at the first error.

Q12.

Python is mainly a(n) ________ language.

Explanation

Python programs are run line by line by the Python interpreter.

Q13.

Who created Python?

Explanation

Guido van Rossum created Python in the Netherlands.

Q14.

In which year was Python first released?

Explanation

Python was first released in 1991.

Q15.

Python was named after:

Explanation

Guido van Rossum named it after the British comedy show Monty Python's Flying Circus.

Q16.

Python is free and its source code is available to everyone. This means it is:

Explanation

Python is free to download and use, and its code is open for anyone to see and improve.

Q17.

A Python program written on Windows can run on Linux or macOS without changes. This feature is called:

Explanation

Python is portable โ€” the same program runs on different operating systems.

Q18.

Python treats Marks and marks as two different names. This means Python is:

Explanation

In Python, uppercase and lowercase letters are different.

Q19.

In Python we don't have to declare the type of a variable before using it. This is called:

Explanation

Python decides the type of a variable from the value given to it while running.

Q20.

Which of these is a LIMITATION of Python?

Explanation

Because Python is interpreted, it usually runs slower than compiled languages.

Q21.

Which of these is NOT a feature of Python?

Explanation

Python is interpreted; it does not need to be compiled into an .exe before running.

Q22.

Python is rarely used for which of these?

Explanation

Python is weak in mobile app development; it is widely used in data, web and AI.

Q23.

When Python finds an error in line 3 of a 5-line program, what happens?

Explanation

Python runs line by line, so it executes the lines before the error and stops at the error.

Q24.

Behind the scenes, Python first converts your program into:

Explanation

Python turns the source code into bytecode, which is then run by the Python Virtual Machine.

Q25.

PVM stands for:

Explanation

The Python Virtual Machine runs the bytecode.

Q26.

IDLE stands for:

Explanation

IDLE is Python's built-in Integrated Development and Learning Environment.

Q27.

What is the prompt shown in the Python Shell?

Explanation

The Python Shell shows >>> when it is ready for a command.

Q28.

In which mode does Python run each statement immediately after you press Enter?

Explanation

In interactive mode, each statement typed at >>> runs at once.

Q29.

Which is a disadvantage of interactive mode?

Explanation

Code typed in interactive mode is lost when the Shell is closed.

Q30.

In which mode do we write a whole program, save it and then run it?

Explanation

Script mode lets you write, save and re-run complete programs.

Q31.

A Python program file is saved with which extension?

Explanation

Python script files use the .py extension, for example marks.py.

Q32.

Which key runs a program in the IDLE editor?

Explanation

Run โ†’ Run Module, or the F5 key, runs the program saved in the editor.

Q33.

In IDLE, which menu option runs a saved program?

Explanation

Run Module (F5) runs the program in the editor.

Q34.

Which window in IDLE shows the >>> prompt?

Explanation

The Python Shell is the interactive window with the >>> prompt.

Q35.

What is the output of:

print(5 + 3)
Explanation

Without quotes, 5 + 3 is calculated and 8 is printed.

Q36.

What is the output of:

print("5 + 3")
Explanation

Inside quotes, 5 + 3 is just text and is printed as it is.

Q37.

What is the output of:

print("Marks:", 90)
Explanation

print() puts a space between items separated by commas.

Q38.

What is the output of:

print(10 * 3)
Explanation

10 * 3 is calculated as 30.

Q39.

What is the output of:

print("Hi", "Ravi")
Explanation

Comma-separated items are printed with one space between them.

Q40.

What is the output of:

print(7 - 2, "apples")
Explanation

7 - 2 is calculated as 5, then a space, then the text.

Q41.

Which statement prints the text Hello correctly?

Explanation

print is written in lowercase and text must be inside quotes.

Q42.

What error does Print("Hi") give in Python?

Explanation

Python is case sensitive; Print is not defined, so NameError occurs.

Q43.

Which symbol starts a comment in Python?

Explanation

Anything after # on a line is a comment and is ignored by Python.

Q44.

What does Python do with a comment?

Explanation

Comments are notes for humans; Python ignores them.

Q45.

What is the output of:

print("Python")  # my first program
Explanation

The part after # is a comment, so only Python is printed.

Q46.

Text written inside quotes in a program is called a:

Explanation

Text in quotes, like "Hello", is a string.

Q47.

Can a string be written in single quotes in Python, like print('Hi')?

Explanation

Python accepts both 'Hi' and "Hi" as strings.

Q48.

What is the output of:

print("2" + "3")
Explanation

Both are strings, so + joins them into 23.

Q49.

What will print() with nothing inside the brackets do?

Explanation

An empty print() just moves to the next line, printing a blank line.

Q50.

Which error occurs in print("Hello) ?

Explanation

The closing quote is missing, so Python cannot understand the statement.

Q51.

Which of the following is the correct way to write Python code in interactive mode?

Explanation

The >>> is shown by Python; you only type the statement after it.

Q52.

A program that runs correctly on Windows but must be completely rewritten for Linux is NOT:

Explanation

A portable program runs on many platforms without change, like Python programs.

Q53.

Which statement about a compiler and an interpreter is TRUE?

Explanation

A compiler works on the whole program; an interpreter works one line at a time.

Q54.

Python's large collection of ready-made modules is called its:

Explanation

Python comes with a huge standard library of ready-to-use modules.

Q55.

Which of these is a valid use of Python in real life?

Explanation

Python is used in data science, web development, AI, automation and more.