Python Introduction & Core Fundamentals Quiz

Python
0 Passed
0% acceptance

A 40-question quiz covering Python introduction, basic syntax, variables, data types, execution model, indentation rules, and foundational concepts.

40 Questions
~80 minutes
1

Question 1

What type of language is Python considered?

A
High-level programming language
B
Low-level assembly language
C
Binary-only language
D
Markup language
2

Question 2

Which feature makes Python code highly readable?

A
Significant indentation
B
Lack of whitespace
C
Mandatory semicolons
D
Curly braces for grouping
3

Question 3

How is Python commonly executed?

A
Interpreted at runtime
B
Compiled directly to machine code
C
Converted into HTML
D
Executed only through hardware chips
4

Question 4

Which symbol is used to start a comment in Python?

A
#
B
//
C
/*
D
<!--
5

Question 5

What does Python rely on instead of braces to define code blocks?

A
Indentation level
B
Semicolon count
C
Special keywords only
D
XML-style tags
6

Question 6

How are variables created in Python?

A
By assigning a value to a name
B
Through explicit type declarations
C
Through manual memory management
D
By compiling assembler code
7

Question 7

What typing system does Python use?

A
Dynamic typing
B
Static typing only
C
No data types
D
Machine-level typing
8

Question 8

Which of the following is a valid Python data type?

A
str
B
text
C
char[]
D
xml
9

Question 9

What type is returned by the expression 5 / 2 in Python?

A
float
B
int
C
str
D
bool
10

Question 10

What does type() do in Python?

A
Returns the type of a value
B
Converts a value to a string
C
Creates a new list
D
Runs a code block
11

Question 11

Which operator is used for exponentiation in Python?

A
**
B
^
C
%
D
!!
12

Question 12

What is the result of 10 // 3?

A
3
B
3.33
C
0
D
3.0
13

Question 13

What does the 'in' keyword check?

A
Membership in a sequence
B
Equality of numbers
C
Sorting order
D
Memory address
14

Question 14

What is the boolean value of an empty list?

A
False
B
True
C
None
D
0 only
15

Question 15

What keyword is used for logical conjunction?

A
and
B
&&
C
plus
D
with
16

Question 16

Which function prints output to the screen?

A
print()
B
echo()
C
display()
D
say()
17

Question 17

What does input() return?

A
A string
B
An integer
C
A boolean
D
A file handle
18

Question 18

Which function gives the number of elements in a list?

A
len()
B
sizeOf()
C
count()
D
measure()
19

Question 19

What does int('7') return?

A
7 (integer)
B
'7'
C
True
D
An error always
20

Question 20

What happens if print() is called with no arguments?

A
It prints a blank line
B
It raises an error
C
It prints zero
D
It prints None
21

Question 21

What type of error results from incorrect indentation?

A
IndentationError
B
TypeError
C
BinaryError
D
RenderError
22

Question 22

What happens when Python encounters a runtime error?

A
Program execution stops
B
Program skips the code silently
C
Values change randomly
D
A warning prints but execution continues
23

Question 23

Which error indicates using a variable before assignment?

A
NameError
B
IndexError
C
ValueError
D
LogicError
24

Question 24

What error occurs when dividing by zero?

A
ZeroDivisionError
B
DivideError
C
ArithmeticWarning
D
LoopError
25

Question 25

Which term refers to detecting problems before running the code?

A
Syntax checking
B
Runtime debugging
C
Memory sweeping
D
Variable linking
26

Question 26

What does this code output?

python
print("Hello")
A
Hello
B
"Hello"
C
print(Hello)
D
Nothing
27

Question 27

What is the result of this code?

python
x = 5
  x = x + 2
  print(x)
A
7
B
5
C
2
D
An error occurs
28

Question 28

What does this produce?

python
a = "3"
  b = 3
  print(a == b)
A
False
B
True
C
3
D
An error
29

Question 29

What is printed by this snippet?

python
nums = [1, 2, 3]
  print(len(nums))
A
3
B
1
C
0
D
An error
30

Question 30

Which keyword begins a function definition?

A
def
B
func
C
method
D
lambda
31

Question 31

Which structure holds key-value pairs?

A
Dictionary
B
Tuple
C
String
D
Set
32

Question 32

What does Python use for grouping multiple values in order?

A
Lists and tuples
B
Tables only
C
Registers
D
Directories
33

Question 33

Which symbol is used for string concatenation?

A
+
B
&
C
@
D
%
34

Question 34

Which value represents 'no value' in Python?

A
None
B
Null
C
Void
D
Blank
35

Question 35

Which loop repeats a block while a condition remains true?

A
while
B
loop
C
repeat
D
foreach
36

Question 36

Which keyword exits a loop immediately?

A
break
B
stop
C
quit
D
done
37

Question 37

Which keyword skips to the next iteration of a loop?

A
continue
B
skip
C
next
D
forward
38

Question 38

What structure is often used to group reusable code?

A
Functions
B
Labels
C
Tables
D
Markers
39

Question 39

Which file extension is commonly used for Python scripts?

A
.py
B
.pt
C
.python
D
.run
40

Question 40

Which phrase best describes Python's philosophy?

A
Emphasis on clarity and simplicity
B
Minimal readability
C
Hardware-level control only
D
Low-level optimization first

QUIZZES IN Python