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

Python Class Test

The document is a class test for the subject T & T Lab, consisting of 12 questions, each carrying 3 marks, with a total of 30 marks available. Students are required to answer any 10 questions within a time limit of 1 hour and 30 minutes. The questions cover various programming tasks and concepts related to Python, including lists, tuples, functions, and Numpy arrays.

Uploaded by

Asthanu Madhav
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)
2 views3 pages

Python Class Test

The document is a class test for the subject T & T Lab, consisting of 12 questions, each carrying 3 marks, with a total of 30 marks available. Students are required to answer any 10 questions within a time limit of 1 hour and 30 minutes. The questions cover various programming tasks and concepts related to Python, including lists, tuples, functions, and Numpy arrays.

Uploaded by

Asthanu Madhav
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

Class Test

Subject: T & T Lab

Each Question carries 3 marks. Answer any 10 Questions.

Full Marks: 30, Time: 1 hr 30


minutes,

Q1. How are lists different from strings when both are sequences?

Q2. How are tuples different from lists when both are sequences?
Q3. Write a program that takes a string with multiple words and then
capitalizes the first letter of each word and forms a new string out
of it.
Q4. Write a program to print alternate characters in a String where
string is entered by the user.
Q5. Write a python function secondLargest(T) which takes as input a tuple T
and returns the second largest element in the tuple.
(May use inbuilt functions too)

Q6. Write a function getPowers(x) that returns a tuple containing x,x 2,x3,and x4.
Read five integers from the user and for each integer read,
print that value raised to the powers 2,3 and 4.

Q7. WAP to accept values from a user. Add a tuple to it and


display its elements one by one. Also display its maximum &
minimum value.

Q8. WAP to input any values for 2 tuples.


Print it, interchange it and then compare them.

Q9. Write a function rowsum() that accepts a 2D list as parameter and


prints the sum of each row.
Eg: 1 2 3
456
789

The output should be:


6
15
24
Q10. Find and write the output of the following python code:
a=10
def call():
global a
a=15
b=20
print(a)
call()

Q11. Find error in following code:-


def DEFA_ARG(n1=1, n2=2,n3):
n1=n1+n2
n2+=n3
print (nl ,n2,n3)
Check()
Check(2, 1)
Check(3,4,5)

Q12.
Create a 5X2 integer array using Numpy from a range between 100 to 200 such that t
difference between each element is 10

You might also like