0% found this document useful (0 votes)
22 views5 pages

Python Coding Contest Instructions

The document outlines a Python programming test consisting of theory and practical coding sections, totaling 60 marks. Part A includes fill-in-the-blanks, true/false statements, and multiple-choice questions, while Part B consists of coding tasks related to a grading system, loan eligibility, fitness tracker, and smart traffic light. Students are instructed to read questions carefully and ensure their code is implemented and tested correctly.

Uploaded by

dipak61
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)
22 views5 pages

Python Coding Contest Instructions

The document outlines a Python programming test consisting of theory and practical coding sections, totaling 60 marks. Part A includes fill-in-the-blanks, true/false statements, and multiple-choice questions, while Part B consists of coding tasks related to a grading system, loan eligibility, fitness tracker, and smart traffic light. Students are instructed to read questions carefully and ensure their code is implemented and tested correctly.

Uploaded by

dipak61
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

CODING

CONTEST
Coding Wise
Python Programming Test (60 Marks)

Instructions for Students:

● Read each question carefully.


● Answer all questions in the space provided.
● Each theory question carries 1 mark.
● Ensure coding questions are correctly implemented and tested.

Part A: Theory (30 Marks)


]\

1. Fill in the Blanks (10 Marks)

● Each question is worth 1 mark.


● The ____ statement is used for decision-making in Python.
● A ____ in Python is a sequence of characters.
● ____ is used to add comments in Python code.
● The symbol ____ is used for exponentiation in Python.
● A ____ loop in Python allows you to repeat code.
● Python uses ____ and ____ as Boolean data types.
● ____ is used to store multiple items in a single variable in Python.
● The ____ operator is used to check equality in Python.
● Python scripts typically have the ____ file extension.
● ____ is the keyword for defining a function in Python.

2. True/False (10 Marks)

● Each statement is worth 1 mark.


● In Python, variable names are case sensitive. (True/False)
● Python supports automatic garbage collection. (True/False)
● Lists in Python are immutable. (True/False)
● The print() function in Python is used to output data. (True/False)
● In Python, '==' compares the value of two objects. (True/False)
● Python can be used for mobile app development. (True/False)
● Tuples in Python can be changed after they are created. (True/False)
● Python is not suitable for data analysis. (True/False)
● Python was created by Guido van Rossum. (True/False)

3. Multiple Choice Questions (MCQs) (10 Marks)

● Each question is worth 5 mark.


What is the output of print(8 % 3)?

1
]\

a) 2
b) 2.67
c) 3
d) 5

Which of these is a correct variable declaration in Python?


a) python_var = 1
b) 1_python_var = 1
c) python-var = 1
d) python?var = 1

Part B: Practical Coding (30


Marks)
Coding Question 3: Grading System(10M)
Task: Develop a program that calculates the final grade of a student based on
their marks. The grading system is as follows:
● Below 50: Fail
● 50 to 59: Pass
● 60 to 69: Good
● 70 to 79: Very Good
● 80 to 89: Excellent
● 90 and above: Outstanding
Input Format: The program should prompt the user to enter the student's
marks as a single integer.

2
]\

Output Format: The program should print the grade (e.g., "Fail", "Pass", "Good",
"Very Good", "Excellent", "Outstanding").
Example:
● Input: 76
● Output: Very Good

Coding Question 4: Loan Eligibility System(10M)


Task: Write a program to determine if an applicant is eligible for a loan. The
eligibility criteria are based on age, annual income, and employment type
(salaried or self-employed).
● Age must be between 22 and 60.
● Minimum annual income of $30,000.
● Salaried applicants are eligible with the minimum criteria, but
self-employed applicants need a minimum annual income of $40,000.
Input Format: The program should ask for the applicant's age, annual income,
and employment type.
Output Format: The program should print "Eligible for loan" or "Not eligible
for loan".
Example:
● Input: Age = 30, Income = 35000, Employment Type = Salaried
● Output: Eligible for loan

3. Harder Coding Question (10 Marks)

Question 1: Fitness Tracker (5M)


Scenario: You're developing a fitness tracker app that recommends daily activity levels
based on steps taken.

3
]\

Problem: Write a program that gives recommendations based on the number of steps
input:
● Below 5,000 steps: "Try to be more active."
● Between 5,000 and 10,000 steps: "Good job on staying active!"
● Above 10,000 steps: "Great work! You're leading a very active lifestyle."
Example Input-Output:
● Input: 7000
● Output: "Good job on staying active!"

Question 2: Smart Traffic Light(5M)


(Scenario: You're programming a smart traffic light that changes its operation based on
the time of day and traffic conditions.
Problem: Write a program that decides the traffic light behavior:
● During rush hour (7-9 AM, 5-7 PM), if the traffic is heavy, the light stays green for
2 minutes; otherwise, 1 minute.
● Outside rush hour, if the traffic is heavy, the light stays green for 1.5 minutes;
otherwise, 45 seconds.
Example Input-Output:
● Input: Time = "18:00", Traffic = "heavy"
● Output: "Green light duration: 2 minutes.

Each coding question should be answered with careful consideration of the input and
output formats, ensuring that the code runs as expected for various inputs.

NOTE- CODE COPIED FROM CHATGPT CAN BE SCANNED BY OUR SCRIPT DO BY


YOURSELF

Best of Luck My Dear Coder

Common questions

Powered by AI

Python's automatic garbage collection helps manage memory by recycling unused objects, reducing the risk of memory leaks. This feature enhances program efficiency by freeing developers from manual memory management. However, it can introduce overhead and affect performance, particularly in real-time applications, due to pauses while collection occurs. Developers can tune garbage collection using the 'gc' module to optimize their programs .

An applicant must be aged between 22 and 60, have a minimum annual income of $30,000, and be either salaried or self-employed. Salaried applicants are eligible with just these criteria, while self-employed applicants need at least $40,000 income. This system logic ensures financial stability and capability to repay loans, differentiating risk profiles between salaried and self-employed individuals .

A Python grading system can be implemented by using conditional statements to assign grades based on predefined ranges of marks, such as Fail for below 50, Pass for 50-59, up to Outstanding for 90 and above. Key considerations include ensuring all possible inputs are covered, handling edge cases, and providing meaningful feedback to users .

The 'if' statement is used for decision-making in Python. It evaluates a condition, and if the condition is true, the block of code inside the 'if' statement is executed. If the condition is false, the code inside the 'else' statement (if present) may be executed .

Guido van Rossum, known as the "Benevolent Dictator For Life" until 2018, was instrumental in designing Python with a focus on simplicity and readability, allowing developers to write clear and logical code. His philosophy emphasized 'There should be one—and preferably only one—obvious way to do it,' which is reflected in Python's structure and standard libraries. His leadership helped foster a large, supportive, and open-minded community .

Python can be used for mobile app development, though it is less commonly used compared to languages like Java or Swift. Its strengths include ease of learning, readability, and a rich ecosystem of libraries. However, its limitations in mobile development are due to performance issues and the absence of a strong native mobile interface. Frameworks like Kivy and BeeWare help bridge these gaps, but they don't offer the same level of integration as native languages .

Python scripts use the .py extension which aids in identifying them as Python executables. Adhering to naming conventions, like 'snake_case' for identifiers, enhances readability and reduces the cognitive load when working in teams. Consistent conventions also facilitate integration with tools and libraries that expect standard naming, improving project maintainability .

The program could use 'if-else' conditions to adjust light duration based on time and traffic inputs, such as extending green light durations during rush hours for heavy traffic. Challenges include handling different time formats, managing input validation, and ensuring the system remains efficient and responsive under high load conditions .

Strings in Python are immutable, meaning once a string is created, its content cannot be changed. In contrast, lists are mutable, allowing elements to be changed, added, or removed. This immutability of strings can affect performance, particularly because each concatenation operation creates a new string. Developers need to be cautious of this for memory management and performance reasons .

Python's automatic garbage collection simplifies memory management by automatically reclaiming memory from unused objects, improving productivity and reducing bugs. However, its drawbacks in real-time applications include potential performance impacts due to garbage collection pauses, which may cause delays if not managed carefully. Developers need to balance the GC frequency and real-time constraints .

You might also like