User-Defined Methods: Class 10 - Logix Kips Icse Computer Applications With Bluej Multiple Choice Questions
User-Defined Methods: Class 10 - Logix Kips Icse Computer Applications With Bluej Multiple Choice Questions
knowledgeboat.com/learn/class-10-logix-icse-computer-applications-java-bluej/solutions/Dq9eQ/java-user-
defined-methods
Chapter 5
Question 1
A method that does not return a value has a ........... return type.
1. double
2. class
3. float
4. void ✓
Question 2
Question 3
Question 4
1. actual parameters
2. formal parameters ✓
3. informal parameters
4. void parameters
Question 5
1/10
The parameters that are passed to the method when it is invoked are called ...........
1. formal parameters
2. actual parameters ✓
3. informal parameters
4. void parameters
Question 6
1. pure method
2. impure method ✓
3. perfect method
4. imperfect method
Question 7
1. Windows
2. Multiple programs
3. Class
4. Method or block it is declared in ✓
Question 8
The technique in which the change in the formal parameter gets reflected in the actual
parameter is known as ...........
1. call by reference ✓
2. call by value
3. call by argument
4. call by method
Question 9
In which technique are the values of actual parameters copied to the formal parameters?
1. call by reference
2. call by value ✓
3. call by argument
4. call by method
Question 10
1. many method
2. multiple method
3. void method
2/10
4. overloaded method ✓
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
In Java, all primitive types are passed by value and all reference types are passed by
reference.
True
Question 7
You can place the return statement in a void method without any expression.
True
Question 8
If a method returns a value, then it must be of the same data type as defined in the
method prototype.
True
Question 9
Question 10
3/10
Methods reside in a class in Java.
True
Question 11
Question 12
The scope of a local variable is limited to the method or the block it is declared in.
True
Question 13
Question 14
An impure method always returns the same value when the same arguments are given.
False
Assignment Questions
Question 1
Answer
A method is a named block of code within a class. It executes a defined set of instructions
when called from another part of the program. The different parts of the method are
access-modifier, type, method-name, parameter-list and method-body.
Question 2
Answer
The method name along with the list of parameters used in the method prototype is
known as method signature.
Question 3
Answer
4/10
[access-modifier] type method-name (parameter-list)
{
method-body;
}
To invoke a method, write the name of the method and specify the value of arguments of
its parameter list. Below example shows the definition and invocation of a method:
Question 4
Answer
Return statement sends back the value given to it from the called method to the caller
method. It also transfers the program control back to the caller method from the called
method.
Question 5
Answer
void in method prototype means that the method does not return any value.
Question 6
Answer
The parameters that appear in the method definition are called formal or dummy
parameters whereas the parameters that appear in the method call are called actual
parameters.
Question 7
Answer
5/10
Static methods are created with static keyword in their method prototype as shown below:
Static methods can be called directly using class name but they can't access instance
variables and non-static methods of the class.
The non-static methods are created without the static keyword in their method prototype
as shown below:
Question 8
Answer
In pass by reference, the reference of the actual parameter is passed to the formal
parameter. Both actual parameter and formal parameter represent the same memory
location so any changes made to the formal parameters get reflected in the actual
parameters.
Question 9
When a method has been declared more than once in a class, how does Java determine
the overloading?
Answer
Overloading is determined based on the number and type of parameters of the method.
Question 10
Answer
Sometimes there are two or more possible matches in the invocation of an overloaded
method. In such cases, the compiler cannot determine the most specific match. This is
referred to as ambiguous invocation. It causes a compile time error. For example, the
below program will cause a compile time error due to ambiguous invocation:
6/10
public class AmbiguousDemo {
Question 11
Answer
1. double z = Check (6, 5); invokes public static double Check(int x, double y)
2. double z = Check (5.5, 7.4); invokes public static double Check(double x, double y)
Question 12
Answer
Question 13
7/10
Which OOP principle implements function (method) overloading?
Answer
Polymorphism
Question 14
A palindromic prime is a prime number and also palindromic. For example, 131, 313, and
757 are prime numbers and also palindromic prime numbers. Write a program that
displays the first 100 palindromic prime numbers.
Answer
boolean prime = c == 2;
return prime;
}
Output
8/10
Question 15
Answer
Changes made to formal parameters are Changes made to formal parameters are
not reflected back to actual parameters. reflected back to actual parameters.
Answer
Pure methods take objects and/or primitive data types Impure methods change the
as arguments but does not modify the objects. state of received objects.
Pure methods doesn't have side effects. Impure methods have side
effects.
Answer
9/10
Simple Method Overloaded method
Simple Methods have unique In case of Overloaded methods, there are two or
names. more methods with the same name.
We can identify the method We need to examine the method's number and type
being invoked by looking at its of parameters to determine which method will be
name. invoked.
Video Explanations
10/10