0% found this document useful (0 votes)
11 views2 pages

Untitled Document

The document outlines a Python coding test consisting of 10 questions, each worth 10 marks, covering various topics such as basic syntax, data types, control statements, loops, functions, lists, dictionaries, file handling, object-oriented programming, and error handling. There is also a bonus question worth 5 marks related to palindrome checking. The total time limit for the test is 60 minutes, with a maximum score of 100 marks.

Uploaded by

pulkitshandilya0
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)
11 views2 pages

Untitled Document

The document outlines a Python coding test consisting of 10 questions, each worth 10 marks, covering various topics such as basic syntax, data types, control statements, loops, functions, lists, dictionaries, file handling, object-oriented programming, and error handling. There is also a bonus question worth 5 marks related to palindrome checking. The total time limit for the test is 60 minutes, with a maximum score of 100 marks.

Uploaded by

pulkitshandilya0
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/ 2

"""

Python Coding Test


Time Limit: 60 minutes
Total Marks: 100
"""

# 1. Basic Syntax (10 Marks)


# Write a Python program to print "Hello, World!".

# 2. Data Types and Variables (10 Marks)


# Write a Python program that takes two numbers as input and swaps them without using a
third variable.

# 3. Control Statements (10 Marks)


# Write a Python program to check if a number is even or odd.

# 4. Loops (10 Marks)


# Write a Python program to print the first 10 Fibonacci numbers using a loop.

# 5. Functions (10 Marks)


# Write a Python function to calculate the factorial of a given number.

def factorial(n):
pass # Implement this function

# 6. Lists and Tuples (10 Marks)


# Write a Python program to find the largest number in a list.

# 7. Dictionaries (10 Marks)


# Write a Python program to count the occurrences of each word in a given string using a
dictionary.

# 8. File Handling (10 Marks)


# Write a Python program to read a text file and count the number of lines in it.

# 9. Object-Oriented Programming (10 Marks)


# Define a Python class "Rectangle" with attributes length and width.
# Include a method to calculate its area.

class Rectangle:
def __init__(self, length, width):
pass # Implement constructor

def area(self):
pass # Implement method

# 10. Error Handling (10 Marks)


# Write a Python program that takes two numbers as input and divides them.
# Handle the case where the denominator is zero using try-except.

# Bonus Question (5 Marks - Optional)


# Write a Python program to check if a given string is a palindrome.

# End of Test

You might also like