Python Programming
Jump to paper
2025100218
B.Tech 2nd Semester Examination, 2025
Instructions
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct option / answer the following (Any seven question
only):
Ask AI
Q1.1
Which of the following is a valid variable name in Python?
Ask AI
Q1.2
Which symbol is used for comments in Python?
Ask AI
Q1.3
Which function is used to take input from the user?
Ask AI
Q1.4
Which of the following will create an empty dictionary?
Ask AI
Q1.5
What is the correct syntax to define a function in Python?
Ask AI
Q1.6
"Hello"[1] gives:
Ask AI
Q1.7
Which method is used to find length of a string?
Ask AI
Q1.8
Lists in Python are
Ask AI
Q1.9
Which method removes the last element from a list?
Ask AI
Q1.10
Which of the following is used to open a file in Python?
Ask AI
Q.2 Solve both questions:
Ask AI
Q2.1
Explain Identifiers, Keywords, Statements, and Expressions in Python.
Ask AI
Q2.2
Explore the working of while and for loop with examples.
Ask AI
Q.3 Solve both questions:
Ask AI
Q3.1
Explain Assignment and Relational operators in python with program?
Ask AI
Q3.2
What is type conversion? Explain with example?
Ask AI
Q.4 Solve both questions:
Ask AI
Q4.1
Explain elseif ladder in python programming with suitable example.
Ask AI
Q4.2
Write a Python program to count how many numbers in a given list are even and how many are odd.
Ask AI
Q.5 Solve both questions:
Ask AI
Q5.1
Explain the scope and lifetime of variables with examples. Also demonstrate how the global keyword is used to modify global variables inside a function.
Ask AI
Q5.2
Write a function factors (N) that returns a list of all positive divisors of N (N>=1).
For example:
factors (6) returns [1,2,3,6]
factors (1) returns [1]
factors (13) returns [1,13]Ask AI
Q.6 Solve both questions:
Ask AI
Q6.1
Explain concatenation, comparison, and length operation. Support your explanation with suitable example programs.
Ask AI
Q6.2
Explain commonly used string methods such as upper(), lower(), strip(), find(), replace(), split(), join(), etc. Write example code demonstrating at least five string methods.
Ask AI
Q.7 Solve both questions:
Ask AI
Q7.1
Explain operations such as concatenation, repetition, membership, and length in list with program?
Ask AI
Q7.2
Explain indexing and slicing in lists with examples. Discuss: Positive and negative indexing, Accessing single elements, Slicing formats: list[start:end], list[start:end:step].
Ask AI
Q.8 Solve both questions:
Ask AI
Q8.1
What are nested loops? Write a program to print the following pattern using nested for loops:
*
* *
* * *
* * * *
Ask AI
Q8.2
Explain commonly used methods like add(), update(), remove(), discard(), union() in set with program?
Ask AI
Q.9 Solve both questions:
Ask AI
Q9.1
How to perform read operation in text file explain with example?
Ask AI
Q9.2
Write a Python function to count the frequency of each character in a given a string and return the output in a dictionary. Example: char_frequency ("HELLO") returns {'H': 1, 'E': 1, 'L': 2, 'O': 1}.
Ask AI
2025V4100218
B.Tech 2nd Semester Examination, 2025
Instructions
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Q.1 Choose the correct option / answer the following (Any seven question
only):
Ask AI
Q1.1
Which of the following is a valid variable name in Python?
Ask AI
Q1.2
Which symbol is used for comments in Python?
Ask AI
Q1.3
Which function is used to take input from the user?
Ask AI
Q1.4
Which of the following will create an empty dictionary?
Ask AI
Q1.5
What is the correct syntax to define a function in Python?
Ask AI
Q1.6
"Hello"[1] gives:
Ask AI
Q1.7
Which method is used to find length of a string?
Ask AI
Q1.8
Lists in Python are
Ask AI
Q1.9
Which method removes the last element from a list?
Ask AI
Q1.10
Which of the following is used to open a file in Python?
Ask AI
Q.2 Solve both questions:
Ask AI
Q2.1
Explain Identifiers, Keywords, Statements, and Expressions in Python.
Ask AI
Q2.2
Explore the working of while and for loop with examples.
Ask AI
Q.3 Solve both questions:
Ask AI
Q3.1
Explain Assignment and Relational operators in python with program?
Ask AI
Q3.2
What is type conversion? Explain with example?
Ask AI
Q.4 Solve both questions:
Ask AI
Q4.1
Explain elseif ladder in python programming with suitable example.
Ask AI
Q4.2
Write a Python program to count how many numbers in a given list are even and how many are odd.
Ask AI
Q.5 Solve both questions:
Ask AI
Q5.1
Explain the scope and lifetime of variables with examples. Also demonstrate how the global keyword is used to modify global variables inside a function.
Ask AI
Q5.2
Write a function factors (N) that returns a list of all positive divisors of N (N>=1).
For example:
factors (6) returns [1,2,3,6]
factors (1) returns [1]
factors (13) returns [1,13]Ask AI
Q.6 Solve both questions:
Ask AI
Q6.1
Explain concatenation, comparison, and length operation. Support your explanation with suitable example programs.
Ask AI
Q6.2
Explain commonly used string methods such as upper(), lower(), strip(), find(), replace(), split(), join(), etc. Write example code demonstrating at least five string methods.
Ask AI
Q.7 Solve both questions:
Ask AI
Q7.1
Explain operations such as concatenation, repetition, membership, and length in list with program?
Ask AI
Q7.2
Explain indexing and slicing in lists with examples. Discuss: Positive and negative indexing, Accessing single elements, Slicing formats: list[start:end], list[start:end:step].
Ask AI
Q.8 Solve both questions:
Ask AI
Q8.1
What are nested loops? Write a program to print the following pattern using nested for loops:
*
* *
* * *
* * * *
Ask AI
Q8.2
Explain commonly used methods like add(), update(), remove(), discard(), union() in set with program?
Ask AI
Q.9 Solve both questions:
Ask AI
Q9.1
How to perform read operation in text file explain with example?
Ask AI
Q9.2
Write a Python function to count the frequency of each character in a given a string and return the output in a dictionary. Example: char_frequency ("HELLO") returns {'H': 1, 'E': 1, 'L': 2, 'O': 1}.
Ask AI