English

Rupa Pandit solutions for Computer Applications [English] Class 10 ICSE chapter 3 - User-Defined Methods [Latest edition]

Advertisements

Chapters

    1: Revision of Class 9 Syllabus

    2: Class as the Basis of all Computation

▶ 3: User-Defined Methods

    4: Constructors

   Chapter 5: Library Classes

   Chapter 6: Encapsulation

   Chapter 7A: Arrays - One Dimension

   Chapter 7B: Arrays - Sort & Search

   Chapter 7C: Arrays - Double Dimension

   Chapter 8: String Handling

   Chapter 9: Programs Overall

Rupa Pandit solutions for Computer Applications [English] Class 10 ICSE chapter 3 - User-Defined Methods - Shaalaa.com
Advertisements

Solutions for Chapter 3: User-Defined Methods

Below listed, you can find solutions for Chapter 3 of CISCE Rupa Pandit for Computer Applications [English] Class 10 ICSE.


Exercises
Exercises [Pages 90 - 95]

Rupa Pandit solutions for Computer Applications [English] Class 10 ICSE 3 User-Defined Methods Exercises [Pages 90 - 95]

Choose the correct option.

1. (i)Page 90

The method prototype is ______.

  • the method name

  • the method argument list

  • the declaration of the method

  • the complete method 

1. (ii)Page 90

The most restrictive access specifier is ______.

  • private

  • public

  • protected

  • default

1. (iii)Page 90

______ statement is used for taking the control back to the super method.

  • void

  • int

  • new

  • return

1. (iv)Page 90

A method name should be ______.

  • a keyword

  • an identifier

  • an object

  • a class

1. (v)Page 90

A method that does not return any value has return type ______.

  • void

  • int

  • none

  • null

1. (vi)Page 90

A method is contained by ______.

  • an object

  • a class

  • a data

  • a value

1. (vii)Page 90

Member data of a class are available to:

  • only public methods

  • only the private methods

  • all the methods

  • none of the methods

1. (viii)Page 90

Write a method prototype name check() which takes an integer argument and returns a char:

  • char check()

  • void check (int x)

  • check (int x)

  • char check (int x)

1. (ix)Page 90

The number of values that a method can return is ______.

  • 1

  • 2

  • 3

  • 4

1. (x)Page 90

A method which does not modify the value of variables is termed as ______.

  • Impure method 

  • Pure method

  • Primitive method

  • User defined method

1. (xi)Page 90

Assertion(A): call by value is known as pure method.

Reason(R): The original value of variable does not change as operation is performed on copied values.

  • Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).

  • Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).

  • Assertion (A) is true and Reason (R) is false.

  • Assertion (A) is false and Reason (R) is true.

Fill in the blanks.

2. (i)Page 91

Local data ______ (can/cannot) be accessed outside the method.

2. (ii)Page 91

The parameters that are used in the ______ (Calling/Called) method are called formal parameters.

2. (iii)Page 91

Methods help in ______ (code/program) reusability.

2. (iv)Page 91

The prototype is the ______ (first/last) line of the method.

2. (v)Page 91

A method can return ______ (one/multiple) variables.

2. (vi)Page 91

When the same method has to be called repeatedly with different values, the method call is placed inside a ______ (loop/conditions).

2. (vii)Page 91

A class ______ (can/cannot) have multiple methods.

2. (viii)Page 91

Java implements polymorphism through ______.

2. (ix)Page 91

Member data of a class are ______ to all the methods of the class.

2. (x)Page 91

A ______ consists of member data and methods.

3. (i)Page 91

State True or False. Correct the false statement.

A method can accept one or more values as arguments.

3. (ii)Page 91

State True or False. Correct the false statement.

A Prototype is the way of declaring a program.

3. (iii)Page 91

State True or False. Correct the false statement.

A Called-method calls a Calling-method.

3. (iv)Page 91

State True or False. Correct the false statement.

A method is contained by a class.

3. (v)Page 91

State True or False. Correct the false statement.

Those data which are declared in a method are called member data.

4. (i)Page 91

Differentiate between formal parameter and actual parameter. 

4. (ii)Page 91

Differentiate between local and member data.

4. (iii)Page 91

Differentiate between calling method and called method.

4. (iv)Page 91

Differentiate between methods with return type void and int.

4. (v)Page 91

Differentiate between main() method and other methods.

4. (vi)Page 91

Differentiate between the pure method and Impure method.

5. (i)Page 91

Answer the following in brief. Give a reason/example wherever applicable.

What is the importance of main() in a program?

5. (ii)Page 91

Answer the following in brief. Give a reason/example wherever applicable.

What are the types of method prototypes?

5. (iii)Page 91

Answer the following in brief. Give a reason/example wherever applicable.

What is the role of return_type in a method?

5. (vi)Page 91

What is meant by method prototype?

5. (v)Page 91

Answer the following in brief. Give a reason/example wherever applicable.

Explain Call by Value and Call by Reference.

5. (vi)Page 91

Answer the following in brief. Give a reason/example wherever applicable.

Give a program example of a method call in a loop.

6. (i)Page 91

Write the prototype of a method.

named fnFest, which has a return type of int and takes one int argument.

6. (ii)Page 91

Write the prototype of a method.

named fnBrit, which has no argument to return and takes no arguments.

6. (iii)Page 92

Write the prototype of a method.

named fnToast, which returns a data of type double and takes two arguments of data type double.

6. (iv)Page 92

Write the prototype of a method.

named fnNook, which returns a boolean value and takes a string argument.

6. (v)Page 92

Write the prototype of a method.

named fnPen, that returns no value and takes 3 integer arguments.

7. (i)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

void fnMax(int n1, int n2)
{
   int max = (n1 > n2) ? n1:n2;
   return max;
}
7. (ii)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int fnMin(int n1, int n2)
{
   return (n1>n2)? n1:n2);
}
7. (iii)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

 int fnTale(int n)
{
   if(n%2=0)
   {
      return(n*n);
   }
   return(n*n* n);
}
7. (iv)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int int fnWork(int p, intq)
{
    int s=p b;
    int r=p*q;
   return s;
   return r;
}
7. (v)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

 double fnTask(double p, double q)
{
    double d = p/q:
    double r = p%q;
    return d, r;
}
7. (vi)Page 92

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int fnJob(int n)
{
    while (n>0)
    {
      int d = n%10;
      n = n/10;
      return d;
    }
}
7. (vii)Page 93

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int fnTotalDigits(int n)
{
    int td=0;
    while(n>0)
    {
        n=n/10;
        td++;
    }
    return td;
    System.out.print("total digits=" + td);
}
7. (viii)Page 93

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

int fnConsign(int a, int b)
{
    if(a > b)
    {
        return а;
    }
    if(b > a)
    {
        return b;
    }
}
7. (ix)Page 93

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

import java.util.*;
public class cl Factorial
{
   void fn Factorial(int num)
   {
      for(int k = 1; k <= num; k++)
              f = f*k;
   }
   public void main()
   {
      int number = 0;
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter the number:");
      number = sc.nextInt();
      int cpy = number, dg = 0, facdg = 0;
      while(cpy > 0)
      {
              dg = cpy % 10;
              facdg = factorial(dg);
              System.out.println("Factorial of "+dg+"="+facdg);
      }
   }
}
7. (x)Page 94

Observe the following code. It may contain Syntax, Logical or runtime errors. Execute it in Java and identify the error, if any. Rewrite the code without the error. Also write the aim of the code.

import java.io.*;
class Paper
}
   int fnBox(int limit)
   {
      for(int sum = 0, t= 1; t <= limit;t++)
              sum = sum + t;
      return sum;
   }
   void main()
   {
      int N;
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter limit:");
      N = sc.nextInt();
      System.out.print("Result=" + fnBox(N));
   }
}
8. (i)Page 94

Write a program as per the given specification.

Design a class to overload a method Action () given that

  1. void Action (int, int) - Print the larger variable
  2. void Action (char, char) - Print the first character in lower case, second character in upper case [assume both are alphabets]
  3. void Action (String, String) – Print the longer string

Write the above methods and the main () method to call the three overloaded methods.

8. (ii)Page 94

Write a program as per the given specification.

Design a class to overload a method Series() given that

  1. long Series (int n) – Returns the product of first n natural numbers (1*2*3 * ... * n)
  2. long Series (int n1, int n2) – Returns the sum of natural numbers from n1 to n2 10 + 11 + 12 + 13 + 14 + 15, here assuming n1 = 10, n2 = 15

Write the above methods and the main () method to call the two overloaded methods.

8. (iii)Page 94

Write a program as per the given specification.

Design a class to overload a method, Verify(), given that

  1. boolean Verify (int n) - return true if n is a Prime number, false otherwise.
  2. boolean Verify (int v, int f) - return true if f is a factor of v, false otherwise.

Write the above methods and the main() method to call the two overloaded methods.

8. (iv)Page 94

Write a program as per the given specification.

Design a class called DeptStore with the following description:

Class Name: DeptStore
Instance variables/Member Data
int cust_num stores the customer number
String name stores the name of the customer
double amt stores the amount of purchase made
double vat stores the value-added tax amount which is 7% of the purchase amount
Member Methods
i. void Input () To input the customer number, name, purchase amount,
ii. void Calculate () To calculate the value added tax amount and modify the purchase amount accordingly.
iii. void Display() To display all the member data with proper output statements.
iv. void main () To create an object of the class and call the member methods.
9.Page 95

Define a class to overload the method display as follows:

void display():

To print the following format using nested
looр
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

void display(int n): To print the square root of each digit of the given number
Example:

n = 4329
output -3.0
     1.414213562
     1.732050808
     2.0

Solutions for 3: User-Defined Methods

Exercises
Rupa Pandit solutions for Computer Applications [English] Class 10 ICSE chapter 3 - User-Defined Methods - Shaalaa.com

Rupa Pandit solutions for Computer Applications [English] Class 10 ICSE chapter 3 - User-Defined Methods

Shaalaa.com has the CISCE Mathematics Computer Applications [English] Class 10 ICSE CISCE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. Rupa Pandit solutions for Mathematics Computer Applications [English] Class 10 ICSE CISCE 3 (User-Defined Methods) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.

Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. Rupa Pandit textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.

Concepts covered in Computer Applications [English] Class 10 ICSE chapter 3 User-Defined Methods are .

Using Rupa Pandit Computer Applications [English] Class 10 ICSE solutions User-Defined Methods exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in Rupa Pandit Solutions are essential questions that can be asked in the final exam. Maximum CISCE Computer Applications [English] Class 10 ICSE students prefer Rupa Pandit Textbook Solutions to score more in exams.

Get the free view of Chapter 3, User-Defined Methods Computer Applications [English] Class 10 ICSE additional questions for Mathematics Computer Applications [English] Class 10 ICSE CISCE, and you can use Shaalaa.com to keep it handy for your exam preparation.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×