JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech II PYTHON PROGRAMMING Previous Question Paper (August/ September - 2022 - R18)

B.Tech | II | II-I | R18 | August/ September - 2022

Answer PaperPaper Code: 153CDMaximum Marks: 75Time: 3 Hours

Answer any five questions

All questions carry equal marks

Main

115 marks
a

Discuss about various kinds of List Access Methods in Python.

8 marks

Answer

List access methods in Python allow for retrieving, modifying, or traversing elements within a list. The primary methods include:

  • Indexing: Accessing a single element using its position. Python uses zero-based indexing, where the first element is at index 0. Negative indexing allows access from the end of the list, where -1 refers to the last element.
  • Slicing: Extracting a sub-list using the syntax list[start:stop:step]. This creates a new list containing elements from the start index up to, but not including, the stop index, with an optional step value.
  • Iteration: Traversing the list using loops. The for loop is the most common way to access each element sequentially. Alternatively, enumerate() can be used to access both the index and the value simultaneously.
  • Membership Testing: Using the in operator to check if a specific element exists within the list, returning a boolean value.
  • List Methods for Access/Search: Methods like index() return the position of the first occurrence of a value, and count() returns the number of times a value appears in the list.
b

Write a python program to find factorial of a given number using functions.

7 marks

Answer

To calculate the factorial of a number using a function, one can use either an iterative approach or a recursive approach. Below is the iterative implementation:

def factorial(n):
    if n < 0:
        return "Factorial does not exist for negative numbers"
    result = 1
    for i in range(1, n + 1):
        result *= i
    return result

num = int(input("Enter a number: "))
print(f"The factorial of {num} is {factorial(num)}")
215 marks
a

List out any five string built-in functions in python.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write a python script for finding given string is palindrome or not.

8 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

How to manipulate directories in python? Explain with suitable examples.

7 marks

Answer

Sign in to view the complete answer paper.

b

Illustrate Math module in python.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Write a program to illustrate “file not found” exception.

7 marks

Answer

Sign in to view the complete answer paper.

b

How to import a module to the python script? Give example.

8 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

How to create a thread? Illustrate with an example.

8 marks

Answer

Sign in to view the complete answer paper.

b

Discuss about thread life cycle.

7 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

Explain the special characters in python.

7 marks

Answer

Sign in to view the complete answer paper.

b

Explain about thread module.

8 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

How to define a canvas? Write a program to draw a bar chart on a Canvas.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write in brief about web surfing in Python.

7 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Write a python script to create a table, delete and display the data from database.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write a python script for database connectivity with an example.

8 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of PYTHON PROGRAMMING from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for B.Tech CSE(CS) II II-I, August/ September - 2022, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in PYTHON PROGRAMMING

Loading Question Papers

Fetching data from database...