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

Class Test - I

The document is a class test for Python Programming for BCA IV Semester students. It includes questions on Python fundamentals such as data types, operators, indentation, and error correction, along with programming tasks. Students are required to answer a selection of questions and correct errors in provided code snippets.

Uploaded by

Shivam Singh
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)
5 views2 pages

Class Test - I

The document is a class test for Python Programming for BCA IV Semester students. It includes questions on Python fundamentals such as data types, operators, indentation, and error correction, along with programming tasks. Students are required to answer a selection of questions and correct errors in provided code snippets.

Uploaded by

Shivam Singh
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

Class Test - I

Python Programming - BCA IV Semester

h
ng
1. What is Python? List some key features of Python.

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

Si
3. Identify the valid and invalid identifiers from the following: my var, 2name,
privateVar, for, userName123.

4. What are Python objects? Explain with an example.

sh
5. What are standard data types in Python? Name them.

6. What is type casting in Python? Convert "100" (string) into an integer.


a
7. Explain indentation in Python. Why is it important?
nd
8. What will be the output of the following?

a = 5
Se

b = "5"
print(a + int(b))
am

9. What will be the output of the following?

print(5>>2)
mb

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


a

Answer any 5
ng

1. Write a Python program to swap two numbers without using a third variable.

2. Differentiate between standard type operators and built-in functions.


Pa

3. What is the difference between is and == operators? Explain with an example.

4. Write a program to take user input and print its data type.

5. Write a Python program to check if a year is a leap year or not.

6. Write a Python program to check if a string is a palindrome (Example: “madam”).

7. Implement a Python program to determine the largest of three numbers.

1
Program Correction (Error Detection & Fixing)
1. Find and correct the error in the following code:

print "Hello, Python!"

2. Identify and correct the mistake in this variable assignment:

h
2name = "Alice"

ng
print(2name)

Si
3. Fix the syntax error in this conditional statement:

x = 10

h
if x > 5
print("x is greater than 5")

as
nd
4. Identify and fix the error in this loop:

for i in range(5)
Se
print(i)

5. What is the difference between if, elif, and else statements?


m

6. Write a Python program to check if a number is positive, negative, or zero using


an if-else statement.
ba

7. Write a Python program to find the factorial of a number using a loop.


m
ga
n
Pa

You might also like