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

Functions - Udf

Uploaded by

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

Functions - Udf

Uploaded by

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

OXALISS INTERNATIONAL SCHOOL (CBSE)

COMPUTER SCIENCE (083)


WORKSHEET
GRADE : XII CHAPTER : WORKING WITH FUNCTIONS

Q1. Write a program to create a function to find the cube of a number. Write proper function calls.

Q2. WAP to find the square of a number.

Q3. WAP to add two numbers using functions.

Q4. WAP to subtract two numbers using functions.

Q5. WAP to find the area of a circle.

Q6. WAP to find the area of a rectangle.

Q7. WAP to find the area of a triangle.

Q8. WAP to find the simple interest.

Q9. WAP to print a simple list inside a function.

Q10. WAP to print numbers from 1 to N inside a function.

Q11. WAP to find whether a person is eligible to vote or not.

Q12. WAP to find whether a person is eligible to drive or not.

Q13. WAP to find whether a number is even or odd.

Q14. WAP to find whether a number is positive or negative.

Q15. WAP to find whether a number is equal to 5 or not.

Q16. WAP to find the factorial of a number.

Q17. WAP to find the average of five numbers.

Q18. WAP to print the first name, middle name and last name of a person.

Q19. WAP to find the sum of N natural numbers.

Q20. WAP to swap two numbers.

Q21. WAP to find the greatest of three numbers using functions.


Q22. WAP to input 10 numbers from the user and find which one is a whole number.

Q23. WAP to perform all arithmetic operations inside a function calculator().

Q24. WAP to create four different functions to perform all arithmetic operations. Call the functions
inside another function calc().

Q25. WAP to create four different functions to find the area of a circle, rectangle, circle and square. Call
the functions inside another function area().

Q26. WAP to create a calculator using functions and return multiple values.

Q27. WAP to input and return five numbers from the user. Return the numbers to the main program
and print them by: 1. Unpacking 2. Tuple indexing

Q.28) Write a python function that takes two numbers and find their product.

Q.29) Write a python function that takes two numbers and print the smaller number. Also write how to
call this function.

Q.30) Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function.
The function returns another list named ‘indexList’ that stores the indices of all Non-Zero Elements of L.
For example: If L contains [12,4,0,11,0,56]
The index List will have - [0,1,3,5]
Q.31) Write a function that receives two string arguments and checks whether they are same-length
strings (returns True in this case otherwise False).

Q.32) Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an argument
and displays the names (in uppercase)of the places whose names are longer than 5 characters.

For example, Consider the following dictionary

PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}

The output should be:

LONDON

NEW YORK

Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple containing
length of each word of a string. For example, if the string is "Come let us have some fun", the tuple will
have (4, 3, 2, 4, 4, 3)

You might also like