Mastering Python: Test Your Knowledge

A vibrant illustration of a computer screen displaying Python code with elements representing various Python concepts like lists, fun<wbr>ctions, and data types in an educational setting. Colorful and engaging design to attract learners.

Mastering Python: Test Your Knowledge

Test your Python programming skills with our engaging quiz designed for learners at all levels. With 27 carefully crafted questions, it’s a great way to reinforce your knowledge and identify areas for improvement.

Features:

  • Multiple choice questions
  • Covers various Python concepts
  • Immediate feedback after submission
27 Questions7 MinutesCreated by CodingGuru753
Who developed Python Programming Language?
Guido van Rossum
Niene Stom
Wick van Rossum
Gandio van Rossum
Which type of Programming does Python support?
Object-oriented programming
Structured programming
Functional programming
All of the mentioned
What will be the value of the following Python expression?
 
4 + 3 % 5
7
2
1
3
What will be the output of the following Python code?
 
i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    I + = 1
1 2 3
None of the mentioned
1 2
Error
Python supports the creation of anonymous functions at runtime, using a construct called _________
Pi
Anonymous
Lambda
None of the mentioned
What will be the output of the following Python code snippet if x=1?
 
x<<2
4
2
1
8
The following Python program can work with ____ parameters.
 
def f(x):
    def f1(*args, **kwargs):
           print("Sanfoundry")
           return x(*args, **kwargs)
    return f1
Any number of
1
5
2
Which of the following is not a core data type in Python programming?
Dictionary
Class
Tuples
List
Which of these is the definition for packages in Python?
A set of main modules
A folder of python modules
A set of programs making use of Python modules
A number of files containing Python definitions and statements
What will be the output of the following Python function?
 
len(["hello",2, 4, 6])

 

Error
6
4
3
What will be the output of the following Python code?
 
x = 'abcd'
for I in x:
    print(i.upper())
0%
0
A B C D
0%
0
Error
0%
0
 
0%
0
None of these
What will be the output of the following Python code snippet?
 
for I in [1, 2, 3, 4][::-1]:
    print (i)



4 3 2 1
Error
1 2 3 4
None of the mentioned
What arithmetic operators cannot be used with strings in Python?
*
-
+
None of the above
What will be the output of the following Python code?
 
print("abc. DEF".capitalize())
ABC. DEF
Abc. Def
Abc. def
Abc. def
Which of the following Python statements will result in the output: 6?
 
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
A[2][1]
A[1][2]
A[2][3]
A[3][2]
What will be the output of the following Python program?
 
i = 0
while I < 5:
    print(i)
    I += 1
    if I == 3:
        break
else:
    print(0)
None of the mentioned
0 1 2
0 1 2 0
Error
To open a file c:\scores.txt for appending data, we use ____________
Outfile = open(“c:\\scores.txt”, “a”)
Outfile = open(“c:\\scores.txt”, “rw”)
Outfile = open(file = “c:\scores.txt”, “w”)
Outfile = open(file = “c:\\scores.txt”, “w”)
To read two characters from a file object infile, we use ____________
Infile.readlines()
Infile.readline()
Infile.read()
Infile.read(2)
How do you rename a file?
Fp.name = ‘new_name.txt
os.rename(existing_name, new_name)
Os.set_name(existing_name, new_name)
Os.rename(fp, new_name)
What happens if no arguments are passed to the seek function?
Error
File position is set to the start of file
File position remains unchanged
File position is set to the end of file
What is returned by math.ceil(3.4)?
3
4
3.0
4.0
Why are local variable names beginning with an underscore discouraged?
They slow down execution
They are used to indicate global variables
They confuse the interpreter
They are used to indicate a private variables of a class
Which of the following is an invalid statement?
A_b_c = 1,000,000
A,b,c = 1000, 2000, 3000
A b c = 1000 2000 3000
A) abc = 1,000,000
What will be the output of the following Python code, if the code is run on Windows operating system?
 
import sys
if sys.platform[:2]== 'wi':
	print("Hello")
Error
No output
Hello
Junk value
What will be the output of the following Python code?
 
def san(x):
    print(x+1)
x=-2
x=4
san(12)
13
10
2
5
Please mention your name
Feedback about test
{"name":"Mastering Python: Test Your Knowledge", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your Python programming skills with our engaging quiz designed for learners at all levels. With 27 carefully crafted questions, it’s a great way to reinforce your knowledge and identify areas for improvement.Features:Multiple choice questionsCovers various Python conceptsImmediate feedback after submission","img":"https:/images/course5.png"}
Powered by: Quiz Maker