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

Python Practical Wee1 Quiz1

The document is a quiz for a Python practical course, featuring questions on variable declaration, user input, valid variable names, and code output. It includes multiple-choice questions that test knowledge of Python syntax and functionality. The quiz is designed to assess understanding of basic Python programming concepts.

Uploaded by

sayyedzuber5ana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python Practical Wee1 Quiz1

The document is a quiz for a Python practical course, featuring questions on variable declaration, user input, valid variable names, and code output. It includes multiple-choice questions that test knowledge of Python syntax and functionality. The quiz is designed to assess understanding of basic Python programming concepts.

Uploaded by

sayyedzuber5ana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Practical :Week 1: Quiz 1

1 What is the correct way to declare a variable in Python?


• ( ) var x = 10
• ( ) int x = 10;

• ( ) x = 10
• ( ) 10 = x
2 Which function is used to take user input in Python?
• ( ) scan()

• ( ) input()
• ( ) read()
• ( ) get_input()
3. Which of the following variable names is valid in Python?
• ( ) 1var

• ( ) _my_var
• ( ) my-var
• ( ) my var
4 What will be the output of the following code?
name = "Alice"
age = 25
print("My name is", name, "and I am", age, "years old.")

• ( ) My name is Alice and I am 25 years old.


• ( ) My name is AliceandI am25years old.
• ( ) My name is Alice & I am 25 years old.
• ( ) Error

5. Which of the following statements is true about variables in Python?


• ( ) Python variables must be declared before assigning a value.
• ( ) Variable names can start with a number.

• ( ) Python variables do not require explicit data types.


• ( ) Variables are case-insensitive in Python

Dr.Deshpande A.S. (PP Practical Week 1 Quiz 1)


6. What is the output of the following code?
x=5
y = "5"
print(x + y)
• ( ) 10
• ( ) "55"
• ( ) TypeError
• ( ) None

7. Which of the following is NOT a valid variable name in Python?


• ( ) my_var
• ( ) _name
• ( ) 2value
• ( ) userInput

8. What is the output of the following code?


python
CopyEdit
x = input("Enter a number: ")
print(type(x))
• ( ) <class 'int'>
• ( ) <class 'float'>
• ( ) <class 'str'>
• ( ) <class 'input'>

Dr.Deshpande A.S. (PP Practical Week 1 Quiz 1)


9. How can you convert user input into an integer in Python?
• ( ) x = input(int())
• ( ) x = int(input())
• ( ) x = str(input())
• ( ) x = input().int()

10. What will happen if you try to assign a value to a keyword like def in Python?
• ( ) It will store the value successfully.
• ( ) It will throw a SyntaxError
• ( ) It will assign the value but give a warning.
• ( ) It will execute with an unexpected result.

11. What is the output of the following code?


a, b, c = 5, 10, 15
print(a + b + c)
• ( ) 51015
• ( ) 15
• ( ) 30
• ( ) 30

12. What will be the value of x after running the following code?
python
CopyEdit
x = 10
x += 5
• ( ) 10
• ( ) 15
• ()5
• ( ) SyntaxError

Dr.Deshpande A.S. (PP Practical Week 1 Quiz 1)


13. What will be the result of this code?
name = "John"
age = 30
print("Hello, my name is " + name + " and I am " + age + " years old.")
• ( ) Hello, my name is John and I am 30 years old.
• ( ) TypeError
• ( ) Hello, my name is John and I am years old.
• ( ) None

14. What is the correct way to declare multiple variables in a single line?
• ( ) x = 5; y = 10; z = 15;
• ( ) x, y, z = 5, 10, 15
• ( ) x = y = z = 5, 10, 15
• ( ) x == 5, y == 10, z == 15

Dr.Deshpande A.S. (PP Practical Week 1 Quiz 1)

You might also like