Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
966 views

UNIT 2 - Python Programming - QUESTION BANK - 2023-24

This document contains 20 questions related to Python programming concepts like loops, conditional statements, functions, and patterns. The questions cover a range of core Python topics including for, while, and nested loops; if/elif/else statements; break and continue; recursion; and generating patterns and shapes. Most questions ask the student to write a Python program to demonstrate their understanding of the concept.

Uploaded by

priyanktutorial
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
966 views

UNIT 2 - Python Programming - QUESTION BANK - 2023-24

This document contains 20 questions related to Python programming concepts like loops, conditional statements, functions, and patterns. The questions cover a range of core Python topics including for, while, and nested loops; if/elif/else statements; break and continue; recursion; and generating patterns and shapes. Most questions ask the student to write a Python program to demonstrate their understanding of the concept.

Uploaded by

priyanktutorial
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ABES ENGINEERING COLLEGE, GHAZIABAD

Unit-2
QUESTION BANK
SUBJECT NAME: PYTHON PROGRAMMING
SUBJECT CODE: BCC-302

Q.No Description CO BL
What is the purpose of the elif statement in Python? How does it differ from if
1 CO2 K2
and else, and why is it important for handling multiple conditions?
Discuss the basic structure of a for loop and for-else in Python. How do you
2 CO2 K2
iterate over a sequence or collection using a for loop?
Develop a Python program that uses a while loop to simulate a basic guessing
game. The program should generate a random number, and the user should guess
3 CO2 K3
it. The game should provide feedback on whether the guess is too high or too low
until the correct number is guessed.
Explain how the continue statement works in a loop. Provide an example of how
4 CO2 K1
you might use continue to skip certain iterations.
Describe the role of the pass statement in Python loops. In what situations would
5 CO2 K2
you use it, and how does it affect program flow?
Create a Python program that checks if a given year is a leap year or not. Use
6 CO2 K3
conditional statements to determine the leap year criteria.
Write a Python program that calculates the sum of all even numbers from 1 to 100
7 using a for loop. CO2 K3

Create a program that takes a list of numbers as input and calculates their product
8 CO2 K3
using a for loop.
Write a Python program that repeatedly asks the user for a number until they enter
9 0. Afterward, calculate and print the sum of all entered numbers using a while CO2 K3
loop.
Create a program that prints all even numbers between 1 and 20 using a for loop,
10 CO2 K3
but skips the number 10 using the continue statement.
Write a Python program that asks the user to enter a series of numbers. Use a
11 while loop to continue prompting for input until the user enters the number 42. CO2 K3
When 42 is entered, terminate the loop using the break statement.
Implement a program that checks whether a given list contains a specific value. If
12 CO2 K3
the value is found, print a message and exit the loop early using the else clause.
Develop a program that takes a string input from the user and counts the number
13 CO2 K3
of vowels (a, e, i, o, u) in the string using a for loop.
Create a program that generates and prints the first N prime numbers, where N is
14 CO2 K3
input by the user.
Implement the Sieve of Eratosthenes algorithm to generate all prime numbers up to
15 CO2 K3
a given limit. Print the prime numbers.
Create a Python program to find the nth Fibonacci number using both recursion
16 and an iterative approach. Compare the efficiency of the two methods for large CO2 K3
values of n.
Write a Python program to print a pattern of asterisks in the shape of a right-
17 CO2 K3
angled triangle. Allow the user to input the height of the triangle.
18 Implement a program that prints the following pattern: CO2 K3
ABES ENGINEERING COLLEGE, GHAZIABAD

Create a program that prints a pattern of numbers in the form of a Pascal's


19 triangle. Allow the user to input the number of rows for the triangle.
CO2 K3

Develop a program to print the following pattern:

20 CO2 K3

You might also like