CLASS XI PRACTICAL QUESTIONS for eaxm

advertisement
Q1.WAP to take a letter from user and print if letter is uppercase alphabet, lowercase alphabet,
digit or some other character.
Q2.WAP to accept monthly salary from the user, find and display income tax with the help of
the following rules:
MONTHLY SALARY
INCOME TAX
9000 OR MORE
40% of monthly salary
7500-8999
30% of monthly salary
7499 or less
20% of monthly salary
Q3.WAP to accept the marks of a child in 5 subject. Compute total and percentage and award
the subject on the basis of the following table:
PERCENTAGE
STREAM
Above 90
Science
80-90
Commerce
70-80
Arts
Less than 70
Look for another school
Q4.An electricity board charges according to following rules:
For the first 100 units
–
40 P per unit (P-Paisa)
For the next 200 units
50 P per unit
Beyond 300 units
60 P per unit
All users have to pay meter charge also, which is Rs 50/
WAP to read the number of units consumed and print out the charge.
Q5.WAP to find the factorial of a number.
Q6.WAp to print the Fibonacci series till n terms:
0 1
1
2
3
5
8
13…..upto n terms
Q7.WAP to check whether the no. is perfect or not.
Q8.WAP to check if the no. is Armstrong or not.
Q9.WAP to check whether the no. is palindrome or not.
Q10.WAP to check if a no. is prime or not
Q11.WAP to find the Greatest Common Divisor (gcd) of two numbers entered by the user
Q12.WAP to check and print all perfect numbers in between 1 to 500.
Q13.WAP to find out all the Armstrong numbers till n number.
Q14.WAP to print the sum of the series:
X1 + x2+ x3 + ………. + xn.
Q15.WAP to print the sum of the series:
1,4,16,25…….n^2.
Q16.WAP to print sum of series:
X1/2 + x2/3 + x3/4 + …………… + xn/(n+1)
Q17.WAP to find the sum of geometric series. Accept a and r from the user:
a+ar1+ar2+ar3+………………….. +arn
Q18. WAP to find the sum of Arithmetic series. Accept a and d from the user:
a+(a+d)+(a+2d)+(a+3d)+………………….. +a(n-1)d
Q19.Define a function which is passed two numbers and the function should return the largest
the largest of the two numbers. Also call the function and pass arguments to it.
Q20.Define a function which is passed a number and the function will return 1 if the no. is
prime otherwise 0. Call the function and check the returned value whether it is 1 or 0 and print
the message “Prime” or “not prime” accordingly.
Q21.Define a function which is passed two arguments x and n, the function should return the
sum of the series:
X1 +X 2 +X3 +X4 +…………………..Xn
Q22.Define a function which is passed two arguments U and n, the function should return the
sum of the series:
U1 / 2!+U 2 / 3!+U3 / 4!+U4 / 5!+…………………..Un/ (n+1)!
Q23.Define a function which is passed marks in five subjects. The function will display the
total and percentage and will allot the grades accordingly:
Percentage
Grade
>=90
A
>=80 and <90
B
<80
C
Q24.Write a function that will display a menu to the user 1. convert temperature from degree
to Celsius 2.) convert temperature from Celsius to degree. The formulas for making the
conversion are as follows:
Tc=(5/9)*(Tf-32)
Tf=(9/5)*Tc+32
Q25.WAF which is passed number of terms(n) as argument to print the sum of the series given
below:
22 +(22+42)+(22+42+62)+…………………………………. Upto n terms
Q26.WAF which is passed number of terms(n) as argument to print the sum of the series given
below:
1 + (1+3)+(1+3+5) +(1+3+5+7) +……………………… upto n terms
Q27.WAF which is passed number of terms(n) as argument to print the sum of the series given
below:
(1) 1+ (1+2) 2 +(1+2+3) 3 +(1+2+3+4) 4 +(1+2+3+4+5) 5+ ………………… upto n terms
Q28.WAF which is passed number of terms(n) and (x) as an arguments to print the sum of the
series given below:
x – 1/3! * x 3 + 1/5!*x5 -1/7! *x7 + 1/9!*x9… upto n terms
Q29.WAF which is passed number of terms(n) and (x) as an arguments to print the sum of the
series given below:
1- x2/2! + x4/4! – x6/6! +………………………..….xn/n!
2Q30.WAP to check the input string is palindrome or not.
Q31.WAP to input a string, count and display the number of blanks in the given string.
Q32.WAP to input a string, count and display the number of alphabets in the given string.
Q33.WAP to input a string, count and display the number of uppercase alphabets in the given
string.
Q34.WAP to input a string, count and display the number of digits in the given string.
Q35.WAP to input a string, count and display the number of vowels in the given string.
Q36.WAP which accepts a string and reverses the string Example : if the array is having
“Computer Science”. Then after reversal it should rearranged as “ecneicS retupmoC”.
Q37.WAP that reads a string and a character. Each occurrence of the given character
(regardless of its case) is converted to opposite case. For example, if the string entered is:A a b
r A c a d and the character as A or a then the output string should be a A b r a c A d See each a
or A is converted to opposite case i.e. upper to lower or vice versa.
Q38.WAP to read a name (first, middle and last name) from a user and produce an output
where the first letter of each name is capatilised and rest all in lower case.Ex. If the input
string is sUmiT kUmAr KhuRana then it should be converted to Sumit Kumar Khurana
Q39.WAP to count words in a string irrespective of spaces.
Q40.WAP to find the frequency of particular alphabet in a string entered by the user.
Q41.WAP to print the words from last For e.g My name is ABC then the program should
display “ABC is name My.”
Q42.WAP to enter string and display the string in cyclic order. For e.g if input string is Puja
then display
Puja
ujaP
jaPu
aPuj
Q43.WAP to input a string and display it in the fashion shown below. E.g. if input string is
INDIA
I
I
IN
NN
IND
DDD
INDI
I I I I
INDIA
AAAAA
Q44.WAP to find substring in a given string. For e.g. search “cat” in “education”. Also display
the no. of occurrences of a given substring in the main string.
Q45.Write a function to find all duplicates in the list.
Q46.Write a function that takes a list of numbers and returns the cumulative sum; that is, a new
list where the its element is the sum of the first i+1 elements from the original list. For example,
the cumulative sum of [1, 2, 3] is [1, 3, 6].
Q47Write a function called is_sorted that takes a list as a parameter and returns True if the list is
sorted in ascending order and False otherwise. You can assume (as a precondition) that the
elements of the list can be compared with the relational operators <, >, etc.
For example, is_sorted ([1, 2, 2]) should return True and is_sorted ([‘b’, ‘a’]) should return
False.
Q48.Write a function called remove_duplicates that takes a list and returns a new list with only
the unique elements from the original. Hint: they don‟t have to be in the same order.
Q49.Write a function that takes in two sorted lists one in ascending order and other in descending
order and merges them to produce another list in ascending order. The lists may not be of same
length and one or both may be empty. Don‟t use any Python built-in methods or functions.
Q50.Use the list of student names. Create a for loop that asks the user for every name whether
they would like to keep the name or delete it. Delete the names which the user no longer wants.
Hint: you cannot go through a list using a for loop and delete elements from the same list
simultaneously because in that way the for loop will not reach all elements. You can either use a
second copy of the list for the loop condition or you can use a second empty list to which you
append the elements that the user does not want to delete.
Q51.Write a function to find product of the element of a list.
Q52.Write a program to input NXM matrix and find sum of all even numbers in the matrix.
Q53.Write a program to print upper triangle matrix.
Q54Write a program to print lower triangle matrix.
Q55Write a program to find sum of rows and columns of a given matrix.
Q56Write a program to find the left and right diagonals of the square matrix.
Q57.Write a function that takes in two sorted lists both in in descending order and merges them to
produce another list in ascending order. The lists may not be of same length and one or both may
be empty. Don‟t use any Python built-in methods or functions.
Q58.Write a function that takes in two sorted lists both in ascending order and merges them to
produce another list in descending order. The lists may not be of same length and one or both may
be empty. Don‟t use any Python built-in methods or functions.
Q59.Write a function that takes in two sorted lists one in ascending order and other in descending
order and merges them to produce another list in descending order. The lists may not be of same
length and one or both may be empty. Don’t use any Python built-in methods or functions.
Download