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

22plc151 QB Module 1 Updated

Uploaded by

dreamsmystic05
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 views3 pages

22plc151 QB Module 1 Updated

Uploaded by

dreamsmystic05
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/ 3

GLOBALACADEMYOFTECHNOLOGY

An Autonomous Institute, Affiliated to VTU


Belagavi,ApprovedbyAICTE,AccreditedbyNAAC,’A’
Grade,
Ideal Homes Township,Rajarajeshwari Nagar,Bengaluru–560098
Tel:+918028603158(Ext-300),Email:[email protected]:www.gat.ac.in

Department of Computer Science and Engineering

(AccreditedbyNBA2022-2025)

2022-23 Odd Semester

Question Bank

Semester: I
Course Name & Code: Python Programming(22PCL151)

Module1
Python Basics, Flow Control

1) List the data types used in Python. Explain each with examples.
2) Explain the following functions in Python with suitable examples. print(), input(), len()
3) Explain the built-in functions which can be used to get the integer, floating-point number or string
version of a value. Give example for each function.
4) List and explain comparison operators used in Python with suitable examples.
5) List and explain math operators used in Python with suitable examples.
6) Explain with an example, how + and * operators work with strings.
7) Explain the basics for executing a python program using REPL (shell) with an example. Write a
python program to read using REPL (shell) and display the output.
8) Explain about different Boolean operators in python with appropriate examples.
9) List the rules for naming available in Python. Identify the following variables as valid and invalid.
Balance, current balance, current-balance, 4account, _spam, 42, current Balance, current balance,
SPAM, total_$um, 'hello', account4
10) Which of the following are operators, and which are values?
* 'hello' -88.8 +
/ - 5 //
11) What does the variable bacon contain after the following code runs?
a) bacon=20
b) bacon++
12) What should the following two expressions evaluate to?
a) 'spam'+'spamspam' b) 'spam'* 3

Prepared by Faculty, Python Programming, GAT Page|1


13) With the syntax and example, explain the following Simple if, if – else, elif
14) With the syntax and example, explain the following while loop, for loop
15) Explain the range() used in for loop in python with an example.
16) Differentiate between break and continue with suitable examples.
17) What do the following expressions evaluate to?
a) (5>4) and (3 ==5)
b) not (5 >4)
c) (5 >4) or (3 ==5)
d) not ((5 >4) or (3 ==5))
e) (True and True) and (True== False)
f) (not False) or (not True)
g) (5-1) * ((7 +1) / (3-1))
18) Write a Python program to swap two numbers using temp variable.
19) Write a Python program to swap two numbers using comma operator.
20) Write a Python program to find Area of Triangle based on Base and Height.
21) Write a Python program to input an integer number and print its last digit.
22) Write a Python program to check whether a given number is even or odd.
23) Write a Python program to input principal and time. If time is more than 8years, assign rate of
interest as 12%, else as 18%. Calculate simple interest and display.
24) Write a Python program to find out if a given year is a leap year or not. Any year which is divisible
by 4 and not by 100 are leap years. Otherwise, any year which is divisible by 400 is also a leap year.
25) Write a Python program to input a number, check whether it is positive number or negative number
or zero. Print the appropriate message.
26) Write a Python program to input a number, check whether it contains single digit or two digits or
three digits or more than two digits.
27) Write a Python program to input a character, check whether it is uppercase letter or lowercase letter
or digit or any other symbol.

28) Write a Python program to input a number and count the number of digits in it using while loop.
29) Write for loop to generate the following series.

a) 1234……50

b) -20 2468 ….. 20

c) 999795 93……1
Prepared by Faculty, Python Programming, GAT Page|2
d) -10-9-8-7 10
e) 12 4 8 16 32
f) 10 -10 20 -20 30 -30…….. 60-60
30) Write for loop to find the sum of the following series

a) Sum = 1 +3+5 + +99


b) Sum=-100 +-99 +…….. +-1
c) Sum = 0 +5+10 +…….+100
31) Write a Python program to find multiplication table of a number.
32) Write a Python program to input a positive integer and find its factorial.
33) Explain how to import modules in python with an example.
34) Write a Python program to print numbers, Even numbers, Odd numbers and Prime numbers
between given range using loop and range function.
35) Write a Python program to get the Fibonacci series between given range.

Prepared by Faculty, Python Programming, GAT Page|3

You might also like