0% found this document useful (0 votes)
2 views

Python Class VII (1)

This document contains a quiz on Python basics for Class VII, covering topics such as file extensions, output of code, software for writing Python, variable types, control statements, loops, and user input functions. Each question provides multiple-choice answers to test understanding of fundamental Python concepts. The quiz aims to assess knowledge of Python programming fundamentals.

Uploaded by

newkhushal24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Class VII (1)

This document contains a quiz on Python basics for Class VII, covering topics such as file extensions, output of code, software for writing Python, variable types, control statements, loops, and user input functions. Each question provides multiple-choice answers to test understanding of fundamental Python concepts. The quiz aims to assess knowledge of Python programming fundamentals.

Uploaded by

newkhushal24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Class VII- Python Basics

1. What is the correct file extension for Python programs?


a) .pt c) .pyt
b) .py d) .python

2. What will the following code output?


print("Hello, World!")
a) Hello, World! c) print("Hello, World!")
b) "Hello, World!" d) Error

3. Which software is commonly used to write and run Python programs?


a) Microsoft Word c) Adobe Photoshop
b) Visual Studio Code d) Windows Explorer

4. What is the name of the window where Python displays output in Visual Studio
Code?
a) Console c) Terminal
b) Output Window d) Debugger

5. What type of variable can be accessed inside all functions in a Python program?
a) Local variable c) Global variable
b) Function variable d) Private variable

6. What will be the output of the following code?


x = 10
x=5
print(x)
a) 10 c) Error
b) 5 d) None

7. What is the purpose of the if statement in Python?


a) To define a variable
b) To perform repetitive tasks
c) To make decisions based on conditions
d) To define a function

8. What will happen if you forget to indent a statement inside an if block?


a) The code will still run
b) Python will automatically indent the statement
c) You will get an indentation error
d) The if statement will be ignored

9. Which of the following is the correct syntax for an if-else statement?


a) if x > 10 c)if x > 10:
b)if (x > 10) { d)if x > 10;
10.What will be the result of 5 % 2 in Python?
a) 2.5 c) 1
b) 2 d) 0

11.Which loop is used when you want to repeat code a fixed number of times?
a) while loop c) repeat loop
b) for loop d) if loop

12.What will the following loop print?


for i in range(3):
print("Hello")
a) Hello
b) Hello Hello Hello
c) Hello (printed 3 times, each on a new line)
d) Error

13.How do you define a loop that runs as long as a condition is true?

a) for loop c) while loop


b) if loop d) repeat loop

14.Which function is used to get user input in Python?

a) read() c) get()
b) input() d) scan()

15.Why do write int while using the input function?

a) To convert input to an integer c) To convert the input into text


value d) None of the above
b) To make the input interesting

You might also like