Skip to content

Tag Archives: Functions

Predict the output of the following program. class Test implements Cloneable {     int a;        Test cloning()     {         try         {             return (Test) super.clone();         }         catch(CloneNotSupportedException… Read More
Predict the output of the following program. class Test {        public static void main(String[] args)     {         String obj1 = new String("geeks");         String obj2 =… Read More
Predict the output of the following program. class Test {     public static void main(String[] args)     {         StringBuffer a = new StringBuffer("geeks");         StringBuffer b = new… Read More
Predict the output of the following program. class Test {     public void demo(String str)     {         String[] arr = str.split(";");         for (String s : arr)         {… Read More
A function is a set of statements that take inputs, do some specific computation and produces output. The idea is to put some commonly or… Read More
Function overloading is a feature of object oriented programming where two or more functions can have the same name but different parameters. When a function… Read More
We have discussed Circular Linked List Introduction and Applications, in the previous post on Circular Linked List. In this post, traversal operation is discussed.    … Read More
#include <stdio.h> #include <stdarg.h> int fun(int n, ...) {     int i, j = 1, val = 0;     va_list p;     va_start(p, n);     for (; j <… Read More
Predict the output? class Main {     public static void main(String args[]) {                 System.out.println(fun());     }        static int fun(int x = 0)     {       return x;     } }… Read More
In Java, can we make functions inline like C++? (A) Yes (B) No Answer: (B) Explanation: Unlike C++, in Java we can’t suggest functions as… Read More
class intWrap {    int x; }  public class Main {      public static void main(String[] args) {        intWrap i = new intWrap();        i.x = 10;        intWrap… Read More
class Test { public static void swap(Integer i, Integer j) {       Integer temp = new Integer(i);       i = j;       j = temp;    }    public static… Read More
public class Main {      public static void main(String args[]) {         String x = null;         giveMeAString(x);         System.out.println(x);      }      static void giveMeAString(String y)      {         y = "GeeksQuiz"; … Read More
Output of following Java program? class Main {     public static void main(String args[]) {                 System.out.println(fun());     }          int fun()     {       return 20;     } } (A)… Read More
In C, what is the meaning of following function prototype with empty parameter list void fun() {    /* .... */ } (A) Function can only… Read More