43 solutions available
Question 1What is a function ? What is its other name ? What is function prototype ?
Question 2What are actual and formal parameters of a function ?
Question 3How do you define and invoke a method?
Question 4A function argument is a value returned by the function to the calling program. (T/F) ?
Question 5How many values can be returned from a function ?
Question 6Explain the difference between actual and formal parameters.
Question 7When a function returns a value, the entire function call can be assigned to a variable. (T/F) ?
Question 8(a)Identify the errors in the function skeletors given below :float average (a, b) { }
Question 8(b)Identify the errors in the function skeletors given below :float mult (int x, y) { }
Question 10What is an ambiguous invocation? Give an example.
Question 9Given the method below, write a main() method that includes everything necessary to call given method.int thrice (int x) { return x * 3 ; }
Question 10What is the principal reason for passing arguments by value ?
Question 11When an argument is passed by reference,a variable is created in the function to hold the argument's value.the function cannot access the...
Question 14A palindromic prime is a prime number and also palindromic. For example, 131, 313, and 757 are prime numbers and also palindromic prime...
Question 15Differentiate between the following:Call by value and Call by reference
Question 14What are the three types of functions in Java?
Question 15Write a function that interchanges the value of two integers A and B without using any extra variable.
Question 16Give the prototype of a function check which receives a character ch and an integer n and returns true or false.
Question 17Write a function that takes an int argument and doubles it. The function does not return a value.
Question 18Differentiate between CALL by reference and CALL by value.
Question 19What is polymorphism? How does function overloading implement polymorphism?
Question 20What is function overloading ?
Question 21What is the significance of function overloading in Java ?
Question 22What is the role of a function's signature in disambiguation process?
Question 23What factors make two definitions with the same function name significantly different ?
Question 24How does the use of constant suffixes help avoid ambiguity when an overloaded function is called ?
Question 25Two methods cannot have the same name in Java. (True/False)
Question 26We can overload methods with differences only in their return type. (True/False)
Question 27Members of a class specified as private are accessible only to the methods of the class. (True/False)
Question 28A method declared as static cannot access non-static class members. (True/False)
Question 29A static class method can be invoked by simply using the name of the method alone. (True/False)
Question 30Which of the following function-definitions are overloading the method given below :int sum(int x, int y) {}int sum(int x, int y, int z) {...
Question 31What is the role of void keyword in declaring functions ?
Question 32How is call-by-value way of function invoking different from call-by-reference way ? Give appropriate examples supporting your answer.
Question 33What is the output of the following program ? Justify your answer.class Check { public static void chg (String (nm) ) { nm =...
Question 34Write a function that takes two char arguments and returns 0 if both the arguments are equal. The function returns -1 if the first...
Question 35Write a complete Java program that invokes a function satis() to find whether four integers a, b, c, d sent to satis( ) satisfy the...
Question 36Write a program that uses a method power( ) to raise a number m to power n. The method takes int values for m and n and returns the result...
Question 37How does the compiler interpret more than one definitions having same name ? What steps does it follow to distinguish these ?
Question 38Discuss how the best match is found when a call to an overloaded method is encountered. Give example(s) to support your answer.
Question 39Design a class to overload a function area( ) as follows :(i) double area(double a, double b, double c) with three double arguments,...
Question 40What is the output of the following program?class AllStatic { static int m = 0 ; static int n = 0 ; public static void...
Question 41What is the output of the following code ?void func(String s) { String s = s1 + "xyz" ; System.out.println("s1 =" + s1) ;...