Python Programming Quiz

Python Programming Quiz for Beginners

Welcome to Python Basics Quiz, It is for Beginners to check their “Python Programming Basics” Knowledge.

 

 


1) What is the file extension for Python files?

.pyth

.py

.pyt

.pt

2) What is a correct syntax to output “Hello Python” in Python?

output (“Hello Python”)

display (“Hello Python”)

print (“Hello Python”)

pt (“Hello Python”)

3) Is Python Case-sensitive Language?

No

Yes

4) Python is weak in___________

Machine Learning and Artificial Intelligence

Mobile Software Development

Scientific and Numeric Software Development

Data Science and Data Visualization

5) How do we insert COMMENTS in Python code?

//This is a comment

*This is a comment

#This is a comment

“This is comment

6) Is Python Object Oriented Programming Language?

Yes

No

7) What is the best IDE to learn Python?

Eclipse PyDev

IDLE

PyCharm

Visual Studio Code

8) Is Python supports explicit declaration of Data Types?

Yes

No

9) It is _____ not a Python Data Structure?

List

Dictionary

Tuple

Group

10) Which keyword is used to define functions in Python?

function

def

method

func

11) Which operator can be used to compare two values?

<>

==

><

=

12) What can you put before and after a section to make all of the lines a comment?

”’

///

###

***

13) How do you create a variable “x” that is equal to 2?

var x = 2

int x = 2

x = 2

variable x = 2

14) Which of the following is not a valid assignment operator?

+=

-=

*=

X=

15) Which one of the following is a valid Python if statement

if a >= 22:

if (a >= 22)

if (a => 22)

if a >= 22

16) What keyword would you use to add an alternative condition to an if statement?

else if

elseif

elif

None of the above

17) Which of the following is a valid for loop in Python?

for(a = 0; a < 3; a++)

for a in range(3)

for a loop 3:

for a in range(1,3):

18) If you have a variable “abcd”, how do you check to see what type of variable you are working with?

getType(abcd)

Type(abcd)

type(abcd)

abcd.type

19) Which of the following is a valid tuple in Python?

sampleTuple = (1,2,3,4,5)

sampleTuple = {1,2,3,4,5}

sampleTuple = [1,2,3,4,5]

sampleTuple = /1,2,3,4,5/

20) What is the keyword used after the try statement to handle exceptions?

catch

exception

next

except

Python Tutorial

Python Online Quiz for Beginners

G C Reddy

G C Reddy, Working as a Software Testing Trainer in Hyderabad, India.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *