Chapter #7 – Functions Chapter #7 – Lab Exercises #2: Write a program that uses a user defined function that accepts name and gender (as M for Male, F for Female) and prefixes Mr/Ms on the basis of the gender. You can checkout the code from Github here – Lab Exercises – 2 How the […]
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #8
Chapter #7 – Functions Chapter #7 – Lab Exercises #1 Write a program to check the divisibility of a number by 7 that is passed as a parameter to the user defined function. You can checkout this code from Github here – Lab Exercises – 1 How the Program Works: Example Output If the user […]
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #7
Chapter #7 – Functions Chapter #7 – Q #7 Does a function always return a value? Explain with an example. Example of a Function Without a Return Value: Consider the following function that prints a message but does not return any value: When you call this function: In this example, the greet function executes the print statement […]
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #6
Chapter #7 – Functions Chapter #7 – Q #6: Differentiate between following with the help of an example: a) Argument and Parameter Example: b) Global and Local variable. Example: NCERT Computer Science Class 11 Chapter 7 Solutions Q 6
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #5
Chapter #7 – Functions Chapter #7 – Q #5 Using an example show how a function in Python can return multiple values. You can return multiple values through a tuple: Return multiple values through a function: Swap variables using a tuple: Combining tuples: Function that returns sum and average: NCERT Computer Science Class 11 Chapter […]
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #4
Chapter #7 – Functions Chapter #7 – Q #4 How is built-in function pow() function different from function math.pow() ? Explain with an example. Differences Between pow() and math.pow() Example: NCERT Computer Science Class 11 Chapter 7 Solutions Q 4
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #3
Chapter #7 – Functions Chapter #7 – Q #3 Out of random() and randint(), which function should we use to generate random numbers between 1 and 5. Justify. NCERT Computer Science Class 11 Chapter 7 Solutions Q 3
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #2
Chapter 7 – Functions Classs #11 – Chapter #7 – Q #2: How is math.ceil(89.7) different from math.floor (89.7)? Summary: Function Input Output math.ceil() 89.7 90 math.floor() 89.7 89 NCERT Computer Science Class 11 Chapter 7 Solutions Q 2
NCERT Computer Science Class #11 – Chapter #7 Solutions – Q #1
Chapter #7 – Functions (a) Observe the following program carefully, and identify the error: Issues in the Code Corrected Code (b) Observe the following program carefully, and identify the error: Issues in the Code: Corrected Code (c) Observe the following program carefully, and identify the error: Issues in the Code: Corrected Code: (d) Observe the […]
NCERT Computer Science Class #11 – Chapter #6 Solutions – Q #15
Chapter #6 – Flow of Control Class 11 – Chapter 6 Solutions – PROGRAMMING EXERCISES #10 Write a program to find the grade of a student when grades are allocated as given in the table below. Percetage of Marks Grade Above 90% A 80% to 90% B 70% to 80% C 60% to 70% D […]