0% found this document useful (0 votes)
2 views

Python_Skill Based Questions (1)

The document contains a series of programming questions and tasks focused on various skills, including finding prime numbers, calculating roots of quadratic equations, and manipulating strings and lists. It also includes questions about mutability and immutability in Python, as well as error identification in code snippets. Additionally, there are programming tasks to create lists, calculate averages, and generate Fibonacci series.

Uploaded by

whatsbackup135
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python_Skill Based Questions (1)

The document contains a series of programming questions and tasks focused on various skills, including finding prime numbers, calculating roots of quadratic equations, and manipulating strings and lists. It also includes questions about mutability and immutability in Python, as well as error identification in code snippets. Additionally, there are programming tasks to create lists, calculate averages, and generate Fibonacci series.

Uploaded by

whatsbackup135
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Skill Based Questions

Q.1 WAP that searches for prime numbers from 15 through 25.

Q.2 WAP to test if given number is prime or not.

Q.3 WAP to compute the result when two numbers and one operator is given by user.

Q.4 WAP to calculate the roots of a given quadratic equation.

Q.5 WAP to input a digit and print it in words.

Q.6 WAP to find the sum of n natural numbers.

Q.7 WAP to find the sum of first n even numbers.

Q.8 WAP to find the sum of first n odd numbers.

Q.9 WAP to print the following series –

(i) 1 4 7 10 . . . . . . ……40

Q10)

Q11) Given a string S = “CARPE DIEM”. If n is length/2 then what would following return?

(a) S[:n] (b) S[n:] (c) S[n:n] (d) S[1:n] (e) S[n:length-1]

Q12) What would following expression return?

(a) ”Hello World”.upper().lower() (b) ”Hello World”.lower().upper() (c) ”Hello World”.find(“Wor”,1,6)


(d) ”Hello World”.find(“Wor”) (e) ”Hello World”.find(“wor”) (f) ”Hello World”.isalpha()
(g) ”Hello World”.isalnum() (h) ”Hello World”.isdigit() (i) “123FGH”.isdigit()

Q13) Suggest appropriate functions for the following tasks –

(a) To check whether the string contains digits. (b) To find the occurrence a string within another string.
(c) To convert the first letter of a string to upper case. (d) To convert all the letters of a string to upper case.
(f) To check whether all the letters of the string are in capital letters.
(g) to remove all the white spaces from the beginning of a string.
Q14) Find the errors - s=”PURA VIDA” Print(s[9] + s[9:15])
Q15) WAP to check the given string is palindrome or not.
Q16) What do you understand by mutability?

Q.17) Start with the list[8,9,10]. Do the following using list functions

(a) Set the second entry (index 1) to 17 (b) Add 4, 5 and 6 to the end of the list.

(c) Remove the first entry from the list. (d) Sort the list.

(e) Double the list. (f) Insert 25 at index 3

Q18)

Q.19 WAP that creates a third list after adding two lists.
Q.20 WAP a program to generate a list of elements of Fibonacci Series.
Q.21 What do you understand by immutability?

Q.22 Does a slice operator always produce a new Tuple? Ans: Yes

Q.23 How is an empty Tuple created?


Ans: To create an empty tuple we have to write – >>>T=() or >>>T=tuple()

Q.24 WAP to calculate the mean of the numbers of the tuple.


Q.25 WAP to calculate the average of the numbers of the tuple.
Q.26 Give reason?
Answers
Find the errors - s=”PURA VIDA” Print(s[9] + s[9:15])
Ans: Here the error is : Sting index out of range.
What do you understand by mutability?
Ans: Mutable means changeable. In Python, mutable types are those whose
values can be changed in place. Only three types are mutable in python – Lists,
Dictionaries and Sets.

You might also like