Question:
What will be the output of the following Java program?
    import java.net.*;    class networking     {        public static void main(String[] args) throws UnknownHostException         {            InetAddress obj1 = InetAddress.getByName("cisco.com");            System.out.print(obj1.getHostName());        }    }

Choices:
- cisco
- cisco.com
- none of the mentioned


Question:
What will be the output of the following Java program?
    import java.net.*;    class networking     {        public static void main(String[] args) throws MalformedURLException         {            URL obj = new URL("https://www.sanfoundry.com/javamcq");            System.out.print(obj.toExternalForm());        }    }

Choices:
- sanfoundry
- sanfoundry.com


Question:
What will be the output of the following Java code?
    import java.net.*;    class networking     {        public static void main(String[] args) throws MalformedURLException         {            URL obj = new URL("https://www.sanfoundry.com/javamcq");            System.out.print(obj.getProtocol());        }    }

Choices:
- http
- https
- www
- com


Question:
What will be the output of the following Java program?
    import java.net.*;    class networking     {        public static void main(String[] args) throws MalformedURLException         {            URL obj = new URL("https://www.sanfoundry.com/javamcq");            System.out.print(obj.getPort());        }    }

Choices:
- 1
- 0
- -1
- garbage value


Question:
What will be the output of the following Java program?
    import java.net.*;    class networking    {        public static void main(String[] args) throws MalformedURLException         {            URL obj = new URL("https://www.sanfoundry.com/javamcq");            System.out.print(obj.getHost());        }    }

Choices:
- sanfoundry
- sanfoundry.com


Question:
What will be the output of the following Java program?
    import java.net.*;    class networking    {        public static void main(String[] args) throws MalformedURLException        {            URL obj = new URL("https://www.sanfoundry.com/javamcq");            System.out.print(obj.toExternalForm());        }    }

Choices:
- sanfoundry
- sanfoundry.com


Question:
What will be the output of the following Java program?
    import java.util.*;    class Arraylist     {        public static void main(String args[])         {            ArrayList obj = new ArrayList();            obj.add("A");            obj.add("B");            obj.add("C");            obj.add(1, "D");            System.out.println(obj);        }    }

Choices:
- [A, B, C, D]
- [A, D, B, C]
- [A, D, C]
- [A, B, C]


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output     {        public static void main(String args[])         {            ArrayList obj = new ArrayList();            obj.add("A");            obj.add(0, "B");            System.out.println(obj.size());        }    }

Choices:
- 0
- 1
- 2
- Any Garbage Value


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output     {        public static void main(String args[])         {            ArrayList obj = new ArrayList();            obj.add("A");            obj.ensureCapacity(3);            System.out.println(obj.size());        }    }

Choices:
- 1
- 2
- 3
- 4


Question:
What will be the output of the following Java program?
    class Output     {        public static void main(String args[])         {            ArrayList obj = new ArrayList();            obj.add("A");            obj.add("D");            obj.ensureCapacity(3);            obj.trimToSize();            System.out.println(obj.size());         }          }

Choices:
- 1
- 2
- 3
- 4


Question:
What will be the output of the following Java code snippet?
public class Demo{  public static void main(String[] args)  {		Map<Integer, Object> sampleMap = new TreeMap<Integer, Object>();		sampleMap.put(1, null); 		sampleMap.put(5, null); 		sampleMap.put(3, null); 		sampleMap.put(2, null); 		sampleMap.put(4, null);         System.out.println(sampleMap);   }}

Choices:
- {1=null, 2=null, 3=null, 4=null, 5=null}
- {5=null}
- Exception is thrown
- {1=null, 5=null, 3=null, 2=null, 4=null}


Question:
What will be the output of the following Java code snippet?
    import java.util.*;    class Linkedlist     {        public static void main(String args[])         {            LinkedList obj = new LinkedList();            obj.add("A");            obj.add("B");            obj.add("C");            obj.addFirst("D");            System.out.println(obj);        }    }

Choices:
- [A, B, C]
- [D, B, C]
- [A, B, C, D]
- [D, A, B, C]


Question:
What will be the output of the following Java program?
    import java.util.*;    class Linkedlist     {        public static void main(String args[])         {            LinkedList obj = new LinkedList();            obj.add("A");            obj.add("B");            obj.add("C");            obj.removeFirst();            System.out.println(obj);        }    }

Choices:
- [A, B]
- [B, C]
- [A, B, C, D]
- [A, B, C]


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output     {        public static void main(String args[])         {            HashSet obj = new HashSet();            obj.add("A");            obj.add("B");            obj.add("C");            System.out.println(obj + " " + obj.size());        }    }

Choices:
- ABC 3
- [A, B, C] 3
- ABC 2
- [A, B, C] 2


Question:
What will be the output of the following Java program?
    import java.util.*;     class Output     {        public static void main(String args[])         {             TreeSet t = new TreeSet();            t.add("3");            t.add("9");            t.add("1");            t.add("4");            t.add("8");             System.out.println(t);        }    }

Choices:
- [1, 3, 5, 8, 9]
- [3, 4, 1, 8, 9]
- [9, 8, 4, 3, 1]
- [1, 3, 4, 8, 9]


Question:
What will be the output of the following Java program?
    import java.util.*;    class Maps     {        public static void main(String args[])         {            HashMap obj = new HashMap();            obj.put("A", new Integer(1));            obj.put("B", new Integer(2));            obj.put("C", new Integer(3));            System.out.println(obj);        }    }

Choices:
- {A 1, B 1, C 1}
- {A, B, C}
- {A-1, B-1, C-1}
- {A=1, B=2, C=3}


Question:
What will be the output of the following Java program?
    import java.util.*;    class Maps     {        public static void main(String args[])         {            HashMap obj = new HashMap();            obj.put("A", new Integer(1));            obj.put("B", new Integer(2));            obj.put("C", new Integer(3));            System.out.println(obj.keySet());        }    }

Choices:
- [A, B, C]
- {A, B, C}
- {1, 2, 3}
- [1, 2, 3]


Question:
What will be the output of the following Java program?
    import java.util.*;    class Maps     {        public static void main(String args[])         {            HashMap obj = new HashMap();            obj.put("A", new Integer(1));            obj.put("B", new Integer(2));            obj.put("C", new Integer(3));            System.out.println(obj.get("B"));        }    }

Choices:
- 1
- 2
- 3
- null


Question:
What will be the output of the following Java program?
    import java.util.*;    class Maps     {        public static void main(String args[])         {            TreeMap obj = new TreeMap();            obj.put("A", new Integer(1));            obj.put("B", new Integer(2));            obj.put("C", new Integer(3));            System.out.println(obj.entrySet());        }    }

Choices:
- [A, B, C]
- [1, 2, 3]
- {A=1, B=2, C=3}
- [A=1, B=2, C=3]


Question:
What will be the output of the following Java code?
    import java.util.*;    class vector     {        public static void main(String args[])         {            Vector obj = new Vector(4,2);            obj.addElement(new Integer(3));            obj.addElement(new Integer(2));            obj.addElement(new Integer(5));            System.out.println(obj.elementAt(1));        }    }

Choices:
- 0
- 3
- 2
- 5


Question:
What will be the output of the following Java code?
    import java.util.*;    class vector     {        public static void main(String args[])         {            Vector obj = new Vector(4,2);            obj.addElement(new Integer(3));            obj.addElement(new Integer(2));            obj.addElement(new Integer(5));            System.out.println(obj.capacity());        }    }

Choices:
- 2
- 3
- 4
- 6


Question:
What will be the output of the following Java code?
    import java.util.*;    class vector     {        public static void main(String args[])         {            Vector obj = new Vector(4,2);            obj.addElement(new Integer(3));            obj.addElement(new Integer(2));            obj.addElement(new Integer(6));            obj.insertElementAt(new Integer(8), 2);            System.out.println(obj);        }    }

Choices:
- [3, 2, 6]
- [3, 2, 8]
- [3, 2, 6, 8]
- [3, 2, 8, 6]


Question:
What will be the output of the following Java code?
    import java.util.*;    class vector     {        public static void main(String args[])         {            Vector obj = new Vector(4,2);            obj.addElement(new Integer(3));            obj.addElement(new Integer(2));            obj.addElement(new Integer(5));            obj.removeAll(obj);            System.out.println(obj.isEmpty());        }    }

Choices:
- 0
- 1
- true
- false


Question:
What will be the output of the following Java code?
    import java.util.*;    class stack     {        public static void main(String args[])         {            Stack obj = new Stack();            obj.push(new Integer(3));            obj.push(new Integer(2));            obj.pop();            obj.push(new Integer(5));     	    System.out.println(obj);        }    }

Choices:
- [3, 5]
- [3, 2]
- [3, 2, 5]
- [3, 5, 2]


Question:
What will be the output of the following Java code?
    import java.util.*;    class hashtable     {        public static void main(String args[])         {            Hashtable obj = new Hashtable();            obj.put("A", new Integer(3));            obj.put("B", new Integer(2));            obj.put("C", new Integer(8));            System.out.print(obj.contains(new Integer(5)));        }    }

Choices:
- 0
- 1
- true
- false


Question:
What will be the output of the following Java code?
    import java.util.*;    class hashtable     {        public static void main(String args[])         {            Hashtable obj = new Hashtable();            obj.put("A", new Integer(3));            obj.put("B", new Integer(2));            obj.put("C", new Integer(8));            obj.clear();            System.out.print(obj.size());        }    }

Choices:
- 0
- 1
- 2
- 3


Question:
What will be the output of the following Java code?
    import java.util.*;    class hashtable     {        public static void main(String args[])         {            Hashtable obj = new Hashtable();            obj.put("A", new Integer(3));            obj.put("B", new Integer(2));            obj.put("C", new Integer(8));            obj.remove(new String("A"));            System.out.print(obj);        }    }

Choices:
- {C=8, B=2}
- [C=8, B=2]
- {A=3, C=8, B=2}
- [A=3, C=8, B=2]


Question:
What will be the output of the following Java code?
    import java.util.*;    class hashtable     {        public static void main(String args[])         {            Hashtable obj = new Hashtable();            obj.put("A", new Integer(3));            obj.put("B", new Integer(2));            obj.put("C", new Integer(8));            System.out.print(obj.toString());        }    }

Choices:
- {C=8, B=2}
- [C=8, B=2]
- {A=3, C=8, B=2}
- [A=3, C=8, B=2]


Question:
What will be the output of the following Java code?
    import java.util.*;    class properties     {        public static void main(String args[])         {            Properties obj = new Properties();            obj.put("AB", new Integer(3));            obj.put("BC", new Integer(2));            obj.put("CD", new Integer(8));            System.out.print(obj.keySet());        }    }

Choices:
- {AB, BC, CD}
- [AB, BC, CD]
- [3, 2, 8]
- {3, 2, 8}


Question:
What will be the output of the following Java code?
    import java.util.*;    class Bitset    {        public static void main(String args[])        {            BitSet obj = new BitSet(5);            for (int i = 0; i < 5; ++i)                obj.set(i);            obj.clear(2);            System.out.print(obj);        }    }

Choices:
- {0, 1, 3, 4}
- {0, 1, 2, 4}
- {0, 1, 2, 3, 4}
- {0, 0, 0, 3, 4}


Question:
What will be the output of the following Java code?
    import java.util.*;    class Bitset     {        public static void main(String args[])        {            BitSet obj = new BitSet(5);            for (int i = 0; i < 5; ++i)                obj.set(i);            obj.clear(2);            System.out.print(obj.length() + " " + obj.size());        }    }

Choices:
- 4 64
- 5 64
- 5 128
- 4 128


Question:
What will be the output of the following Java code?
    import java.util.*;    class Bitset    {        public static void main(String args[])        {            BitSet obj = new BitSet(5);            for (int i = 0; i < 5; ++i)                obj.set(i);            System.out.print(obj.get(3));        }    }

Choices:
- 2
- 3
- 4
- 5


Question:
What will be the output of the following Java code?
    import java.util.*;    class date    {        public static void main(String args[])        {            Date obj = new Date();            System.out.print(obj);        }    }

Choices:
- Prints Present Date
- Runtime Error
- Any Garbage Value
- Prints Present Time & Date


Question:
What will be the output of the following Java code?
    import java.util.*;    class Bitset    {        public static void main(String args[])        {            BitSet obj1 = new BitSet(5);            BitSet obj2 = new BitSet(10);            for (int i = 0; i < 5; ++i)                obj1.set(i);            for (int i = 3; i < 13; ++i)                obj2.set(i);            obj1.and(obj2);            System.out.print(obj1);        }    }

Choices:
- {0, 1}
- {2, 4}
- {3, 4}
- {3, 4, 5}


Question:
What will be the output of the following Java code?
    import java.lang.reflect.*;    class Additional_packages     {	          public static void main(String args[])          {	     try              {	         Class c = Class.forName("java.awt.Dimension");		 Constructor constructors[] = c.getConstructors();		 for (int i = 0; i < constructors.length; i++)		     System.out.println(constructors[i]);	     }	     catch (Exception e)             {             System.out.print("Exception");             }        }    }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the possible constructors of class ‘Class’
- Program prints “Exception”
- Runtime Error


Question:
What will be the output of the following Java code?
    import java.lang.reflect.*;    class Additional_packages     {	          public static void main(String args[])         {	     try              {	         Class c = Class.forName("java.awt.Dimension");		 Field fields[] = c.getFields();		 for (int i = 0; i < fields.length; i++)		     System.out.println(fields[i]);	     }	     catch (Exception e)             {             System.out.print("Exception");             }        }        }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the methods of ‘java.awt.Dimension’ package
- Program prints all the data members of ‘java.awt.Dimension’ package
- program prints all the methods and data member of ‘java.awt.Dimension’ package


Question:
What is the length of the application box made in the following Java program?
    import java.awt.*;    import java.applet.*;    public class myapplet extends Applet     {        Graphic g;        g.drawString("A Simple Applet",20,20);        }

Choices:
- 20
- Default value
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java program?
    import java.lang.reflect.*;    class Additional_packages    {	          public static void main(String args[])         {	     try             {	         Class c = Class.forName("java.awt.Dimension");		 Method methods[] = c.getMethods();		 for (int i = 0; i < methods.length; i++)		     System.out.println(methods[i]);	     }	     catch (Exception e)             {             System.out.print("Exception");             }        }    }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the methods of ‘java.awt.Dimension’ package
- Program prints all the data members of ‘java.awt.Dimension’ package
- program prints all the methods and data member of ‘java.awt.Dimension’ package


Question:
What will be the output of the following Java program?
    import java.util.*;    class Array     {        public static void main(String args[])         {            int array[] = new int [5];            for (int i = 5; i > 0; i--)                array[5-i] = i;            Arrays.fill(array, 1, 4, 8);            for (int i = 0; i < 5 ; i++)                System.out.print(array[i]);        }    }

Choices:
- 12885
- 12845
- 58881
- 54881


Question:
What will be the output of the following Java program?
    import java.util.*;    class Bitset     {        public static void main(String args[])         {            BitSet obj = new BitSet(5);            for (int i = 0; i < 5; ++i)                obj.set(i);            obj.clear(2);            System.out.print(obj);        }    }

Choices:
- {0, 1, 3, 4}
- {0, 1, 2, 4}
- {0, 1, 2, 3, 4}
- {0, 0, 0, 3, 4}


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_iterators     {        public static void main(String args[])         {            ListIterator a = list.listIterator();                if(a.previousIndex()! = -1)                    while(a.hasNext())	                System.out.print(a.next() + " ");                else                   System.out.print("EMPTY");        }    }

Choices:
- 0
- 1
- -1
- EMPTY


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_iterators     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 2
- 2 1 8 5


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_iterators     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    Collections.sort(list);            while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 1 2 5 8
- 2 1 8 5


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_iterators     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    Collections.shuffle(list);            i.next();            i.remove();            while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5
- 2 1 8
- 2 5 8
- 8 5 1


Question:
What will be the output of the following Java program?
    import java.util.*;    class Arraylist     {        public static void main(String args[])        {            ArrayList obj1 = new ArrayList();            ArrayList obj2 = new ArrayList();            obj1.add("A");            obj1.add("B");            obj2.add("A");            obj2.add(1, "B");            System.out.println(obj1.equals(obj2));        }    }

Choices:
- 0
- 1
- true
- false


Question:
What will be the output of the following Java program?
    import java.util.*;    class Array    {        public static void main(String args[])         {            int array[] = new int [5];            for (int i = 5; i > 0; i--)                array[5 - i] = i;            Arrays.sort(array);            for (int i = 0; i < 5; ++i)            	System.out.print(array[i]);;        }    }

Choices:
- 12345
- 54321
- 1234
- 5432


Question:
What will be the output of the following Java program?
    import java.util.*;    class Array     {        public static void main(String args[])         {            int array[] = new int [5];            for (int i = 5; i > 0; i--)                array[5 - i] = i;            Arrays.sort(array);            System.out.print(Arrays.binarySearch(array, 4));        }    }

Choices:
- 2
- 3
- 4
- 5


Question:
What will be the output of the following Java program?
    import java.util.*;    class Array     {        public static void main(String args[])         {            int array[] = new int [5];            for (int i = 5; i > 0; i--)                array[5 - i] = i;            Arrays.sort(array);            for (int i = 0; i < 5; ++i)            	System.out.print(array[i]);;        }    }

Choices:
- 12345
- 54321
- 1234
- 5432


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_Algos     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    Collections.sort(list);            while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 1 2 5 8
- 2 1 8 5


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_Algos     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    Collections.shuffle(list);            while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 1 2 5 8
- Any random order


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_Algos     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();	    while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 2
- 2 1 8 5


Question:
What will be the output of the following Java program?
    import java.util.*;    class Collection_Algos     {        public static void main(String args[])         {            LinkedList list = new LinkedList();            list.add(new Integer(2));            list.add(new Integer(8));            list.add(new Integer(5));            list.add(new Integer(1));            Iterator i = list.iterator();            Collections.reverse(list);	    while(i.hasNext())	        System.out.print(i.next() + " ");        }    }

Choices:
- 2 8 5 1
- 1 5 8 2
- 2
- 2 1 8 5


Question:
What will be the output of the following Java program?
    class exception_handling     {        public static void main(String args[])         {            try             {                System.out.print("Hello" + " " + 1 / 0);            }            catch(ArithmeticException e)             {        	System.out.print("World");        	            }        }    }

Choices:
- Hello
- World
- HelloWorld
- Hello World


Question:
What will be the output of the following Java program?
    class exception_handling     {        public static void main(String args[])         {            try            {                int a, b;                b = 0;                a = 5 / b;                System.out.print("A");            }            catch(ArithmeticException e)             {        	System.out.print("B");        	            }        }    }

Choices:
- A
- B
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java program?
    class exception_handling     {        public static void main(String args[])         {            try             {                int a, b;                b = 0;                a = 5 / b;                System.out.print("A");            }            catch(ArithmeticException e)             {        	System.out.print("B");        	            }            finally             {    	        System.out.print("C");            }        }    }

Choices:
- A
- B
- AC
- BC


Question:
What will be the output of the following Java program?
    class exception_handling     {        public static void main(String args[])         {            try             {                int i, sum;                sum = 10;                for (i = -1; i < 3 ;++i)                    sum = (sum / i);            }            catch(ArithmeticException e)             {        	System.out.print("0");        	            }             System.out.print(sum);        }    }

Choices:
- 0
- 05
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])         {            try             {                System.out.print("Hello" + " " + 1 / 0);            }            finally             {        	System.out.print("World");        	            }        }    }

Choices:
- Hello
- World
- Compilation Error
- First Exception then World


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])         {            try             {                int i, sum;                sum = 10;                for (i = -1; i < 3 ;++i)                 {                    sum = (sum / i);                System.out.print(i);                }            }            catch(ArithmeticException e)             {     	                System.out.print("0");            }        }    }

Choices:
- -1
- 0
- -10
- -101


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])         {            try             {                int a = args.length;                int b = 10 / a;                System.out.print(a);                try                 {                    if (a == 1)                        a = a / a - a;                    if (a == 2)                     {                        int []c = {1};                        c[8] = 9;                    }                }                catch (ArrayIndexOutOfBoundException e)                 {                    System.out.println("TypeA");                }                catch (ArithmeticException e)                 {                    System.out.println("TypeB");                }            }        }    }

Choices:
- TypeA
- TypeB
- Compile Time Error
- 0TypeB


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])         {            try             {                System.out.print("A");                throw new NullPointerException ("Hello");            }            catch(ArithmeticException e)             {                System.out.print("B");        	            }        }    }

Choices:
- A
- B
- Hello
- Runtime Exception


Question:
What will be the output of the following Java code?
public class San  {      public static void main(String[] args)     {        try         {             return;         }         finally         {            System.out.println( "Finally" );         }     } }

Choices:
- Finally
- Compilation fails
- The code runs with no output
- An exception is thrown at runtime


Question:
What will be the output of the following Java code?
public class San {    public static void main(String args[])    {        try         {            System.out.print("Hello world ");        }        finally         {            System.out.println("Finally executing ");        }    }}

Choices:
- The program will not compile because no exceptions are specified
- The program will not compile because no catch clauses are specified
- Hello world
- Hello world Finally executing


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])         {            try             {                throw new NullPointerException ("Hello");            }            catch(ArithmeticException e)            {        	System.out.print("B");        	            }        }    }

Choices:
- A
- B
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
class exception_handling         {            public static void main(String args[])            {                try                 {                    int a = 1;                    int b = 10 / a;                    try                     {                         if (a == 1)                             a = a / a - a;                         if (a == 2)                          {                             int c[] = {1};                             c[8] = 9;                         }                    }                    finally                     {                        System.out.print("A");                    }                }                catch (Exception e)                 {                        System.out.println("B");                }            }        }

Choices:
- A
- B
- AB
- BA


Question:
What will be the output of the following Java code?
    class Output     {        public static void main(String args[])         {           try            {               int a = 0;               int b = 5;               int c = b / a;               System.out.print("Hello");           }           catch(Exception e)            {               System.out.print("World");           }         }    }

Choices:
- Hello
- World
- HelloWOrld
- Compilation Error


Question:
What will be the output of the following Java code?
    class Output     {        public static void main(String args[])         {           try            {               int a = 0;               int b = 5;               int c = a / b;               System.out.print("Hello");           }           catch(Exception e)            {               System.out.print("World");           }         }    }

Choices:
- Hello
- World
- HelloWOrld
- Compilation Error


Question:
What will be the output of the following Java code?
    class Output     {        public static void main(String args[])         {           try            {               int a = 0;               int b = 5;               int c = b / a;               System.out.print("Hello");           }         }    }

Choices:
- Hello
- World
- HelloWOrld
- Compilation Error


Question:
What will be the output of the following Java code?
    class Output     {        public static void main(String args[])         {           try            {               int a = 0;               int b = 5;               int c = a / b;               System.out.print("Hello");           }           finally            {               System.out.print("World");           }         }    }

Choices:
- Hello
- World
- HelloWOrld
- Compilation Error


Question:
What will be the output of the following Java code?
    class Output     {        public static void main(String args[])         {           try           {               int a = 0;               int b = 5;               int c = b / a;               System.out.print("Hello");           }           catch(Exception e)            {               System.out.print("World");           }            finally            {               System.out.print("World");           }         }    }

Choices:
- Hello
- World
- HelloWOrld
- WorldWorld


Question:
What will be the output of the following Java code?
    class Myexception extends Exception     {	int detail;        Myexception(int a)        {            detail = a;	}	public String toString()        {	    return "detail";	}    }    class Output     {        static void compute (int a) throws Myexception         {	     throw new Myexception(a);	 	}	public static void main(String args[])         {            try            {                compute(3);            }           catch(Myexception e)           {               System.out.print("Exception");           }         }    }

Choices:
- 3
- Exception
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code?
    class Myexception extends Exception     {	int detail;        Myexception(int a)         {        detail = a;	}	public String toString()         {	    return "detail";	}    }    class Output     {        static void compute (int a) throws Myexception        {	     throw new Myexception(a);	 	}	public static void main(String args[])         {            try             {                compute(3);            }           catch(DevideByZeroException e)           {               System.out.print("Exception");           }         }    }

Choices:
- 3
- Exception
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code?
    class exception_handling     {        public static void main(String args[])        {            try             {                throw new NullPointerException ("Hello");                System.out.print("A");            }            catch(ArithmeticException e)             {        	System.out.print("B");        	            }        }    }

Choices:
- A
- B
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class Myexception extends Exception     {	int detail;        Myexception(int a)        {        detail = a;	}	public String toString()        {	    return "detail";	}    }    class Output    {        static void compute (int a) throws Myexception        {	     throw new Myexception(a);	 	}	public static void main(String args[])        {            try             {                compute(3);            }           catch(Exception e)           {               System.out.print("Exception");           }         }    }

Choices:
- 3
- Exception
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code?
    class newthread extends Thread     {	newthread()        {	    super("My Thread");	    start();	}	public void run()        {	    System.out.println(this);	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- My Thread
- Thread[My Thread,5,main]
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class newthread extends Thread     {	Thread t;	newthread()        {	    t = new Thread(this,"My Thread");	    t.start();	}	public void run()        {            try            {                t.join()   	        System.out.println(t.getName());            }            catch(Exception e)            {            System.out.print("Exception");            }	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- My Thread
- Thread[My Thread,5,main]
- Exception
- Runtime Error


Question:
What will be the output of the following Java code?
    class newthread extends Thread    {	Thread t;	newthread()        {	    t = new Thread(this,"New Thread");	    t.start();	}	public void run()        {	   System.out.println(t.isAlive());	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- 0
- 1
- true
- false


Question:
What will be the output of the following Java code?
    class newthread extends Thread    {	Thread t1,t2;	newthread()        {	    t1 = new Thread(this,"Thread_1");	    t2 = new Thread(this,"Thread_2");	    t1.start();	    t2.start();	}	public void run()        {	    t2.setPriority(Thread.MAX_PRIORITY);		    System.out.print(t1.equals(t2));        }        }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- true
- false
- truetrue
- falsefalse


Question:
What will be the output of the following Java code?
    class newthread implements Runnable     {	Thread t;	newthread()         {	    t = new Thread(this,"My Thread");	    t.start();	}	public void run()        {	    System.out.println(t.getName());	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- My Thread
- Thread[My Thread,5,main]
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class newthread implements Runnable    {	Thread t;	newthread()        {	    t = new Thread(this,"My Thread");	    t.start();	}	public void run()        {	    System.out.println(t);	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- My Thread
- Thread[My Thread,5,main]
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class newthread implements Runnable    {	Thread t;	newthread()        {	    t = new Thread(this,"My Thread");	    t.start();	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- My Thread
- Thread[My Thread,5,main]
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java code?
    class newthread implements Runnable    {	Thread t;	newthread()        {	    t = new Thread(this,"New Thread");	    t.start();	}	public void run()        {	    t.setPriority(Thread.MAX_PRIORITY);	            System.out.println(t);	}    }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- Thread[New Thread,0,main]
- Thread[New Thread,1,main]
- Thread[New Thread,5,main]
- Thread[New Thread,10,main]


Question:
What will be the output of the following Java code?
    class newthread implements Runnable    {	Thread t;	newthread()        {	    t1 = new Thread(this,"Thread_1");	    t2 = new Thread(this,"Thread_2");	    t1.start();	    t2.start();	}	public void run()        {	    t2.setPriority(Thread.MAX_PRIORITY);		    System.out.print(t1.equals(t2));        }        }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- true
- false
- truetrue
- falsefalse


Question:
What will be the output of the following Java code?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            t.setName("New Thread");            System.out.println(t);                }    }

Choices:
- Thread[5,main]
- Thread[New Thread,5]
- Thread[main,5,main]
- Thread[New Thread,5,main]


Question:
What is the priority of the thread in output in the following Java program?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            t.setName("New Thread");            System.out.println(t.getName());                }    }

Choices:
- main
- Thread
- New Thread
- Thread[New Thread,5,main]


Question:
What is the name of the thread in output in the following Java program?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            System.out.println(t.getPriority());                }    }

Choices:
- 0
- 1
- 4
- 5


Question:
What is the name of the thread in output in the following Java program?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            System.out.println(t.isAlive());                }    }

Choices:
- 0
- 1
- true
- false


Question:
What will be the output of the following Java code?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            System.out.println(t);                }    }

Choices:
- Thread[5,main]
- Thread[main,5]
- Thread[main,0]
- Thread[main,5,main]


Question:
What is the priority of the thread in the following Java Program?
    class multithreaded_programing     {        public static void main(String args[])        {            Thread t = Thread.currentThread();            System.out.println(t);                }    }

Choices:
- 4
- 5
- 0
- 1


Question:
What is the name of the thread in the following Java Program?
    class multithreaded_programing    {        public static void main(String args[])        {            Thread t = Thread.currentThread();            System.out.println(t);                }    }

Choices:
- main
- Thread
- System
- None of the mentioned


Question:
What will be the output of the following Java program?
    class newthread extends Thread    {	Thread t;	String name;	newthread(String threadname)        {	    name = threadname;	    t = new Thread(this,name);	    t.start();	}	public void run()        {        }     }    class multithreaded_programing    {        public static void main(String args[])        {	    newthread obj1 = 	 new newthread("one");	    newthread obj2 =	 new newthread("two");            try            {                obj1.t.wait();	                System.out.print(obj1.t.isAlive());            }            catch(Exception e)            {	    System.out.print("Main thread interrupted");            }        }    }

Choices:
- true
- false
- Main thread interrupted
- None of the mentioned


Question:
What will be the output of the following Java program?
    class newthread extends Thread    {	Thread t;	String name;	newthread(String threadname)        {	    name = threadname;	    t = new Thread(this,name);	    t.start();	}	public void run()        {        }     }    class multithreaded_programing    {        public static void main(String args[])        {	    newthread obj1 = 	 new newthread("one");	    newthread obj2 =	 new newthread("two");            try            {                Thread.sleep(1000);	                System.out.print(obj1.t.isAlive());            }            catch(InterruptedException e)            {	    System.out.print("Main thread interrupted");            }        }    }

Choices:
- true
- false
- Main thread interrupted
- None of the mentioned


Question:
What will be the output of the following Java program?
    class newthread extends Thread    {	Thread t;	String name;	newthread(String threadname)        {	    name = threadname;	    t = new Thread(this,name);	    t.start();	}	public void run()        {        }     }    class multithreaded_programing    {        public static void main(String args[])        {	    newthread obj1 = 	 new newthread("one");	    newthread obj2 =	 new newthread("two");            try            {                 System.out.print(obj1.t.equals(obj2.t));            }            catch(Exception e)            {	    System.out.print("Main thread interrupted");            }        }    }

Choices:
- true
- false
- Main thread interrupted
- None of the mentioned


Question:
What will be the output of the following Java program?
    class newthread extends Thread    {	Thread t;	newthread()        {	    t1 = new Thread(this,"Thread_1");	    t2 = new Thread(this,"Thread_2");	    t1.start();	    t2.start();	}	public void run()        {	    t2.setPriority(Thread.MAX_PRIORITY);		    System.out.print(t1.equals(t2));        }        }    class multithreaded_programing    {        public static void main(String args[])        {            new newthread();                }    }

Choices:
- true
- false
- truetrue
- falsefalse


Question:
What will be the output of the following Java program if input given is ‘abcqfghqbcd’?
    class Input_Output    {        public static void main(String args[]) throws IOException        {	             char c;            BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));            do            {                c = (char) obj.read();	        System.out.print(c);            } while(c != 'q');        }    }

Choices:
- abcqfgh
- abc
- abcq
- abcqfghq


Question:
What will be the output of the following Java program if input given is “abc’def/’egh”?
    class Input_Output    {        public static void main(String args[]) throws IOException        {	             char c;            BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));            do             {                c = (char) obj.read();	        System.out.print(c);            } while(c!='\'');        }    }

Choices:
- abc’
- abcdef/’
- abc’def/’egh
- abcqfghq


Question:
What will be the output of the following Java program?
    class output    {        public static void main(String args[])        {              StringBuffer c = new StringBuffer("Hello");             System.out.println(c.length());        }    }

Choices:
- 4
- 5
- 6
- 7


Question:
What will be the output of the following Java program if input given is “Hello stop World”?
    class Input_Output     {        public static void main(String args[]) throws IOException        {	             string str;            BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));            do            {                str = (char) obj.readLine();	        System.out.print(str);            } while(!str.equals("strong"));        }    }

Choices:
- Hello
- Hello stop
- World
- Hello stop World


Question:
What will be the output of the following Java program?
    class output    {        public static void main(String args[])        {              StringBuffer c = new StringBuffer("Hello");             StringBuffer c1 = new StringBuffer(" World");             c.append(c1);             System.out.println(c);        }    }

Choices:
- Hello
- World
- Helloworld
- Hello World


Question:
What will be the output of the following Java program?
    class output    {        public static void main(String args[])        {            StringBuffer s1 = new StringBuffer("Hello");           s1.setCharAt(1,x);           System.out.println(s1);        }    }

Choices:
- xello
- xxxxx
- Hxllo
- Hexlo


Question:
What will be the output of the following Java program if input given is “abc’def/’egh”?
    class Input_Output    {        public static void main(String args[]) throws IOException        {	             char c;            BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));            do            {                c = (char) obj.read();	        System.out.print(c);            } while(c != '\'');        }    }

Choices:
- abc’
- abcdef/’
- abc’def/’egh
- abcqfghq


Question:
What will be the output of the following Java program?
    class output    {        public static void main(String args[])        {            String a="hello i love java";            System.out.println(indexof('i')+" "+indexof('o')+" "+lastIndexof('i')+" "+lastIndexof('o') ));        }    }

Choices:
- 6 4 6 9
- 5 4 5 9
- 7 8 8 9
- 4 3 6 9


Question:
What will be the output of the following Java program?
    class output    {        public static void main(String args[])        {            StringBuffer s1 = new StringBuffer("Hello");           StringBuffer s2 = s1.reverse();           System.out.println(s2);        }    }

Choices:
- Hello
- olleH
- HelloolleH
- olleHHello


Question:
What will be the output of the following Java program?
    import java.io.*;    public class filesinputoutput    {    	public static void main(String[] args)        { 	   String obj  = "abc";           byte b[] = obj.getBytes();           ByteArrayInputStream obj1 = new ByteArrayInputStream(b);           for (int i = 0; i < 2; ++ i)           {               int c;               while((c = obj1.read()) != -1)               {            	   if(i == 0)                   {            	       System.out.print(Character.toUpperCase((char)c));                       obj2.write(1);             	   }               }               System.out.print(obj2);           }        }    }

Choices:
- AaBaCa
- ABCaaa
- AaaBaaCaa
- AaBaaCaaa


Question:
What will be the output of the following Java program?
    import java.io.*;    class Chararrayinput    {        public static void main(String[] args)        {	    String obj  = "abcdef";            int length = obj.length();            char c[] = new char[length];            obj.getChars(0, length, c, 0);            CharArrayReader input1 = new CharArrayReader(c);            CharArrayReader input2 = new CharArrayReader(c, 0, 3);            int i;            try            {		while((i = input2.read()) != -1)                {                    System.out.print((char)i);                }       	    }             catch (IOException e)            {                e.printStackTrace();	    }	}    }

Choices:
- abc
- abcd
- abcde
- abcdef


Question:
What will be the output of the following Java program?
    import java.io.*;    class Chararrayinput    {        public static void main(String[] args)        {	    String obj  = "abcdefgh";            int length = obj.length();            char c[] = new char[length];            obj.getChars(0, length, c, 0);            CharArrayReader input1 = new CharArrayReader(c);            CharArrayReader input2 = new CharArrayReader(c, 1, 4);            int i;            int j;            try             {		while((i = input1.read()) == (j = input2.read()))                {                    System.out.print((char)i);                }       	    }             catch (IOException e)            {                e.printStackTrace();	    }	}    }

Choices:
- abc
- abcd
- abcde
- none of the mentioned


Question:
What is the Message is displayed in the applet made by the following Java program?
    import java.awt.*;    import java.applet.*;    public class myapplet extends Applet    {        public void paint(Graphics g)        {            g.drawString("A Simple Applet", 20, 20);            }    }

Choices:
- A Simple Applet
- A Simple Applet 20 20
- Compilation Error
- Runtime Error


Question:
What is the length of the application box made by the following Java program?
    import java.awt.*;    import java.applet.*;    public class myapplet extends Applet    {        public void paint(Graphics g)        {            g.drawString("A Simple Applet", 20, 20);            }    }

Choices:
- 20
- 50
- 100
- System dependent


Question:
What is the length of the application box made the following Java program?
    import java.awt.*;    import java.applet.*;    public class myapplet extends Applet    {        Graphic g;        g.drawString("A Simple Applet", 20, 20);        }

Choices:
- 20
- Default value
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java program?
    import java.io.*;    class Chararrayinput    {        public static void main(String[] args)        {	    String obj  = "abcdefgh";            int length = obj.length();            char c[] = new char[length];            obj.getChars(0, length, c, 0);            CharArrayReader input1 = new CharArrayReader(c);            CharArrayReader input2 = new CharArrayReader(c, 1, 4);            int i;            int j;            try            {		while((i = input1.read()) == (j = input2.read()))                {                    System.out.print((char)i);                }       	    }             catch (IOException e)            {                e.printStackTrace();	    }	}    }

Choices:
- abc
- abcd
- abcde
- none of the mentioned


Question:
What will be the output of the following Java program?
    import java.util.*;    class LOCALE_CLASS    {        public static void main(String args[])        {            Locale obj = new Locale("INDIA") ;            System.out.print(obj.getCountry());        }    }

Choices:
- India
- INDIA
- Compilation Error
- Nothing is displayed


Question:
What will be the output of the following Java program?
    import java.util.*;    class LOCALE_CLASS    {        public static void main(String args[])        {            Locale obj = new Locale("HINDI", "INDIA") ;            System.out.print(obj.getCountry());        }    }

Choices:
- India
- INDIA
- Compilation Error
- Nothing is displayed


Question:
What will be the output of the following Java program?
    import java.util.*;    class LOCALE_CLASS    {        public static void main(String args[])        {            Locale obj = new Locale("HINDI") ;            System.out.print(obj.getDisplayLanguage());        }    }

Choices:
- India
- INDIA
- HINDI
- Nothing is displayed


Question:
What will be the output of the following Java program?
    import java.util.*;    class LOCALE_CLASS    {        public static void main(String args[])        {            Locale obj = new Locale("HINDI", "INDIA") ;            System.out.print(obj.getDisplayLanguage());        }    }

Choices:
- India
- INDIA
- HINDI
- Nothing is displayed


Question:
What will be the output of the following Java program?
    package pkg;    class output     {        public static void main(String args[])        {             StringBuffer s1 = new StringBuffer("Hello");            s1.setCharAt(1, x);            System.out.println(s1);        }    }

Choices:
- xello
- xxxxx
- Hxllo
- Hexlo


Question:
What will be the output of the following Java program?
    interface calculate    {        void cal(int item);    }    class display implements calculate    {        int x;        public void cal(int item)        {            x = item * item;                    }    }    class interfaces    {        public static void main(String args[])        {            display arr = new display;            arr.x = 0;                  arr.cal(2);            System.out.print(arr.x);        }    }

Choices:
- 0
- 2
- 4
- None of the mentioned


Question:
What will be the output of the following Java program?
    interface calculate    {        void cal(int item);    }    class displayA implements calculate    {        int x;        public void cal(int item)        {            x = item * item;                    }    }    class displayB implements calculate    {        int x;        public void cal(int item)        {            x = item / item;                    }    }    class interfaces     {        public static void main(String args[])        {            displayA arr1 = new displayA;            displayB arr2 = new displayB;            arr1.x = 0;            arr2.x = 0;                  arr1.cal(2);            arr2.cal(2);            System.out.print(arr1.x + " " + arr2.x);        }    }

Choices:
- 0 0
- 2 2
- 4 1
- 1 4


Question:
What will be the output of the following Java program?
interface calculate {            int VAR = 0;            void cal(int item);}        class display implements calculate         {            int x;          public  void cal(int item)          {                if (item<2)                    x = VAR;                else                    x = item * item;                        }        } class interfaces {             public static void main(String args[])             {                display[] arr=new display[3];                for(int i=0;i<3;i++)               arr[i]=new display();               arr[0].cal(0);                   arr[1].cal(1);               arr[2].cal(2);               System.out.print(arr[0].x+" " + arr[1].x + " " + arr[2].x);            }}

Choices:
- 0 1 2
- 0 2 4
- 0 0 4
- 0 1 4


Question:
What will be the output of the following Java program?
    import java.lang.reflect.*;    class Additional_packages    {	          public static void main(String args[])         {	     try             {	         Class c = Class.forName("java.awt.Dimension");		 Constructor constructors[] = c.getConstructors();		 for (int i = 0; i < constructors.length; i++)		     System.out.println(constructors[i]);	     }	     catch (Exception e)             {                   System.out.print("Exception");             }        }    }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the possible constructors of class ‘Class’
- Program prints “Exception”
- Runtime Error


Question:
What will be the output of the following Java program?
    import java.lang.reflect.*;    class Additional_packages    {	          public static void main(String args[])          {	     try             {	         Class c = Class.forName("java.awt.Dimension");		 Field fields[] = c.getFields();		 for (int i = 0; i < fields.length; i++)		     System.out.println(fields[i]);	     }	     catch (Exception e)             {                   System.out.print("Exception");             }        }    }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the methods of ‘java.awt.Dimension’ package
- Program prints all the data members of ‘java.awt.Dimension’ package
- program prints all the methods and data member of ‘java.awt.Dimension’ package


Question:
What is the length of the application box made in the following Java program?
    import java.awt.*;    import java.applet.*;    public class myapplet extends Applet    {        Graphic g;        g.drawString("A Simple Applet",20,20);        }

Choices:
- 20
- Default value
- Compilation Error
- Runtime Error


Question:
What will be the output of the following Java program?
    import java.lang.reflect.*;    class Additional_packages     {	          public static void main(String args[])          {	     try             {	         Class c = Class.forName("java.awt.Dimension");		 Method methods[] = c.getMethods();		 for (int i = 0; i < methods.length; i++)		     System.out.println(methods[i]);	     }	     catch (Exception e)             {                 System.out.print("Exception");             }        }    }

Choices:
- Program prints all the constructors of ‘java.awt.Dimension’ package
- Program prints all the methods of ‘java.awt.Dimension’ package
- Program prints all the data members of ‘java.awt.Dimension’ package
- program prints all the methods and data member of ‘java.awt.Dimension’ package


Question:
What will be the output of the following Java program?
    public class BoxDemo    {        public static <U> void addBox(U u, java.util.List<Box<U>> boxes)        {           Box<U> box = new Box<>();           box.set(u);           boxes.add(box);        }        public static <U> void outputBoxes(java.util.List<Box<U>> boxes)        {            int counter = 0;            for (Box<U> box: boxes)            {                U boxContents = box.get();                System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");                counter++;            }        }        public static void main(String[] args)        {            java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();            BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);            BoxDemo.outputBoxes(listOfIntegerBoxes);        }    }

Choices:
- 10
- Box #0 [10]
- Box contains [10]
- Box #0 contains [10]


Question:
What will be the output of the following Java program?
    public class BoxDemo    {        public static <U> void addBox(U u,         java.util.List<Box<U>> boxes)        {           Box<U> box = new Box<>();           box.set(u);           boxes.add(box);        }        public static <U> void outputBoxes(java.util.List<Box<U>> boxes)         {            int counter = 0;            for (Box<U> box: boxes)             {                U boxContents = box.get();                System.out.println("[" + boxContents.toString() + "]");                counter++;            }        }        public static void main(String[] args)        {            java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();            BoxDemo.<Integer>addBox(Integer.valueOf(0), listOfIntegerBoxes);            BoxDemo.outputBoxes(listOfIntegerBoxes);        }    }

Choices:
- 0
- 1
- [1]
- [0]


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>     {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.print(gs.pop() + " ");            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- Error
- Hello
- 36
- Hello 36


Question:
What will be the output of the following Java program?
    public class BoxDemo     {        public static <U> void addBox(U u,         java.util.List<Box<U>> boxes)         {           Box<U> box = new Box<>();           box.set(u);           boxes.add(box);        }        public static <U> void outputBoxes(java.util.List<Box<U>> boxes)        {            int counter = 0;            for (Box<U> box: boxes)             {                U boxContents = box.get();                System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");                counter++;            }        }                public static void main(String[] args)        {            java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();            BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);            BoxDemo.outputBoxes(listOfIntegerBoxes);        }    }

Choices:
- 10
- Box #0 [10]
- Box contains [10]
- Box #0 contains [10]


Question:
What will be the correct option of the following Java code snippet?
interface ICust {}class RegularCustomer implements ICust {}class OneTimeCustomer implements ICust {}

Choices:
- ICust can be replaced with RegularCustomer
- RegularCustomer can be replaced with OneTimeCustomer
- OneTimeCustomer can be replaced with RegularCustomer
- We can instantiate objects of ICust


Question:
What will be the output of the following Java code snippet?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}class Main() {   public static void main(String[] args)   {	Shape shape = new Shape();	Square square = new Square();	shape = square;	System.out.println(shape.area());    }}

Choices:
- Compilation failure
- Runtime failure
- 1
- 2


Question:
What will be the output of the following Java code snippet?
public class Shape {	public int area()        {		return 1;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}class Main() {   public static void main(String[] args)   {	Shape shape = new Shape();	Rectangle rect = new Rectangle();	shape = rect;	System.out.println(shape.area());   }}

Choices:
- Compilation failure
- 3
- 1
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}class Main() {   public static void main(String[] args)   {	Shape shape = new Shape();	Square square = new Square();	square = shape;	System.out.println(square.area());   }}

Choices:
- Compilation failure
- 3
- 1
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}class Main() {   public static void main(String[] args)   {	Shape shape = new Shape();	Square square = new Square();    	Rectangle rect = new Rectangle();	rect = (Rectangle)shape;	System.out.println(square.area());   }}

Choices:
- Compilation failure
- 3
- Runtime Exception
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}class Main() {      public static void main(String[] args)      {	 Shape shape = new Shape();	 Square square = new Square();   	 Rectangle rect = new Rectangle();	 rect = (Rectangle)square;	 System.out.println(square.area());      }}

Choices:
- Compilation failure
- 3
- Runtime Exception
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}class Main() {       public static void main(String[] args)       {	 Shape shape = new Shape();	 Square square = new Square();   	 Rectangle rect = new Rectangle();	 rect = (Rectangle)square;	 System.out.println(square.area());	}}

Choices:
- Compilation failure
- 3
- Runtime Exception
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}public static void main(String[] args){	 Shape shape = new Square();   	 shape = new Rectangle();	 System.out.println(shape.area());}

Choices:
- Compilation failure
- 3
- Runtime Exception
- 2


Question:
What will be the output of the following Java code?
public class Shape {	public int area()        {		return 1;	}}public class Square extends Shape {	public int area()        {		return 2;	}}public class Rectangle extends Shape {	public int area()        {		return 3;	}}public static void main(String[] args){	 Shape square = new Square();   	 Shape rect = new Rectangle();     	 square = rect;	 System.out.println(square.area());}

Choices:
- Compilation failure
- 3
- Runtime Exception
- 2


Question:
ii)
public boolean xyz(int num){	return (num & 1)!= 0; }

Choices:
- i
- ii
- (i) causes compilation error
- (ii) causes compilation error


Question:
What will be the output of the following Java code?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)         {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- 0
- 36
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.print(gs.pop() + " ");            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- Error
- Hello
- 36
- Hello 36


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>     {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output     {        public static void main(String args[])        {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)         {            stk.push(obj);	}	public E pop()         {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}        public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- 0
- 36
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();        public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output     {        public static void main(String args[])         {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.print(gs.pop() + " ");            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- Error
- Hello
- 36
- Hello 36


Question:
What will be the output of the following Java program?
    public class BoxDemo    {        public static <U> void addBox(U u,            java.util.List<Box<U>> boxes)          {            Box<U> box = new Box<>();            box.set(u);            boxes.add(box);          }        public static <U> void outputBoxes(java.util.List<Box<U>> boxes)        {            int counter = 0;            for (Box<U> box: boxes)            {                U boxContents = box.get();                System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");                counter++;            }        }        public static void main(String[] args)        {            java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();            BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);            BoxDemo.outputBoxes(listOfIntegerBoxes);        }    }

Choices:
- 10
- Box #0 [10]
- Box contains [10]
- Box #0 contains [10]


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)         {            stk.push(obj);	}	public E pop()         {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <String> gs = new genericstack<String>();            gs.push("Hello");            System.out.print(gs.pop() + " ");            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- Error
- Hello
- 36
- Hello 36


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output    {        public static double sumOfList(List<? extends Number> list)         {            double s = 0.0;            for (Number n : list)                s += n.doubleValue();            return s;        }        public static void main(String args[])        {           List<Double> ld = Arrays.asList(1.2, 2.3, 3.5);           System.out.println(sumOfList(ld));        }    }

Choices:
- 5.0
- 7.0
- 8.0
- 6.0


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output    {        public static void addNumbers(List<? super Integer> list)        {            for (int i = 1; i <= 10; i++)            {                list.add(i);            }        }        public static void main(String args[])        {           List<Double> ld = Arrays.asList();           addnumbers(10.4);           System.out.println("getList(2)");        }    }

Choices:
- 1
- 2
- 3
- 6


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()        {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])         {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output    {        public static double sumOfList(List<? extends Number> list)        {            double s = 0.0;            for (Number n : list)                s += n.doubleValue();            return s;        }        public static void main(String args[])        {            List<Integer> li = Arrays.asList(1, 2, 3);            System.out.println(sumOfList(li));        }    }

Choices:
- 0
- 4
- 5.0
- 6.0


Question:
What will be the output of the following Java program?
    import java.util.*;    class Output     {        public static double sumOfList(List<? extends Number> list)        {            double s = 0.0;            for (Number n : list)                s += n.doubleValue();            return s;        }        public static void main(String args[])         {           List<Double> ld = Arrays.asList(1.2, 2.3, 3.5);           System.out.println(sumOfList(ld));        }    }

Choices:
- 5.0
- 7.0
- 8.0
- 6.0


Question:
What will be the output of the following Java program?
    import java.util.*;    public class genericstack <E>    {        Stack <E> stk = new Stack <E>();	public void push(E obj)        {            stk.push(obj);	}	public E pop()         {            E obj = stk.pop();	    return obj;	}    }    class Output    {        public static void main(String args[])        {            genericstack <Integer> gs = new genericstack<Integer>();            gs.push(36);            System.out.println(gs.pop());        }    }

Choices:
- H
- Hello
- Runtime Error
- Compilation Error


Question:
What will be the output of the following Java code snippet?
try (InputStream is = ...) {    // do stuff with is...} catch (IOException e) {    // handle exception}

Choices:
- Runtime Error
- IOException
- Compilation Error
- Runs successfully


Question:
What will be the output of the following JavaScript code?

var txt1 = "good";
var txt2 = "day";
document.getElementById("demo").innerHTML = txt1 + txt2;

Choices:
- good day
- goodday
- error
- undefined


Question: What will be the output of the following JavaScript code?

Choices:
- 0
- 1
- 2
- 5


Question: What will be the output of the following JavaScript code?

Choices:
- 5
- 10
- 50
- Error


Question: What will be the output of the following JavaScript code?

Choices:
- onetwo
- one two
- error
- undefined


Question: What will be the output of the following JavaScript code?

Choices:
- integer
- number
- string
- error


Question:
What will be the output of the following JavaScript code?
function compare()
{
    int num=2;
    char b=2;
    if(a==b)
        return true;
    else
        return false;
}

Choices:
- true
- false
- runtime error
- compilation error


Question:
What will be the output of the following JavaScript code?
function equalto()
{
    int num=10;
    if(num===”10”)
        return true;
    else
        return false;
}

Choices:
- true
- false
- runtime error
- compilation error


Question:
What will be the output of the following JavaScript code?
function compare()
{
    int a=1;
    char b=1;
    if(a.tostring()===b)
        return true;
    else
        return false;
}

Choices:
- true
- false
- runtime error
- logical error


Question:
What will be the output of the following JavaScript code?
int a==2;
int b=4;
int ans=a+b;
print(ans);

Choices:
- 2
- 6
- 0
- error


Question:
What will be the output of the following JavaScript code?
int a=1;
if(a!=null)
    return 1;
else
    return 0;

Choices:
- 1
- 0
- runtime error
- compiler error


Question:
What will be the output of the following JavaScript code?
var string1 = ”123”;
var intvalue = 123;
alert( string1 + intvalue );

Choices:
- 123246
- 246
- 123123
- Exception


Question:
What will be the output of the following JavaScript code?
function output(option)
{
	return (option ?  “yes” :  “no”);
}
	bool ans=true;
console.log(output(ans));

Choices:
- Yes
- No
- Runtime error
- Compilation error


Question:
What will be the output of the following JavaScript code?
var  obj=
{
	length:20,
	height:35,
}
if (‘breadth' in obj === false)
{
  	obj.breadth = 12;
}

console.log(obj.breadth);

Choices:
- 20
- 12
- undefined
- error


Question:
What will be the output of the following JavaScript code?
function height()
{
    var  height = 123.56;
    var type = (height>=190) ? "tall" : "short";
    return type;
}

Choices:
- 123.56
- 190
- tall
- short


Question:
What will be the output of the following JavaScript code?
string  a = ”hi”;
string  b =”there”;
alert(a+b);

Choices:
- hi
- there
- hithere
- undefined


Question:
What will be the output of the following JavaScript code?
function output(object)
{
	var place=object ? object.place : “Italy”;
	return “clean:”+ place;
}
console.log(output({place:India}));

Choices:
- clean:India
- clean:Italy
- error
- undefined


Question: What will be the output of the following JavaScript code?

Choices:
- 7.25
- -7.25
- 7
- -7


Question: What will be the output of the following JavaScript code?

Choices:
- 125
- 25
- 5
- Error


Question: What will be the output of the following JavaScript code?

Choices:
- 1.01
- 1.047
- 1.00
- 1.4


Question:
What will be the output of the following JavaScript code?
var a=5 , b=1
var obj = { a : 10 }
with(obj)
{
      alert(b)
}

Choices:
- 10
- Error
- 1
- 5


Question:
Code 2 :
var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

Choices:
- Code 1
- Code 2
- Both Code 1 and Code 2
- Cannot Compare


Question:
In the following switch syntax, the expression is compared with the case labels using which of the following operator(s)?
switch(expression)
{
    statements
}

Choices:
- equals
- equal


Question:
What happens in the following javaScript code snippet?
var count = 0;
while (count < 10)
{
     console.log(count);
     count++;
}

Choices:
- The values of count are logged or stored in a particular location or storage
- The value of count from 0 to 9 is displayed in the console
- An error is displayed
- An exception is thrown


Question:
What will be the output of the following JavaScript code?
Int a=1;
if(a>10)
{
    document.write(10);
}
else
{
    document.write(a);
}

Choices:
- 10
- 0
- 1
- Undefined


Question:
What will be the output of the following JavaScript code?
var grade='B';
var result;
switch(grade)
{
    case 'A':
    {
        result+="10";
        break;
    }
    case 'B':
    {
        result+=" 9";
        break;
    }
    case 'C':
    {
        result+=" 8";
        break;
    }
    default:
    result+=" 0";
}
document.write(result);

Choices:
- 10
- 9
- 8
- 0


Question:
What will be the output of the following JavaScript code?
var grade='A';
var result;
switch(grade)
{
    case 'A':
        result+="10";
    case 'B':
        result+=" 9";
    case 'C':
        result+=" 8";
    default:
        result+=" 0";
}
document.write(result);

Choices:
- 10
- 27
- 8
- 0


Question:
What will be the output of the following JavaScript code?
int a=4;
int b=1;
int c=0;
If(a==b)
    document.write(a);
else if(a==c)
    document.write(a);
else
    document.write(c);

Choices:
- 4
- 1
- Error
- 0


Question:
What will be the output of the following JavaScript code?
var grade='E';
var result;
switch(grade)
{
    case 'A':
        result+="10";
    case 'B':
        result+=" 9";
    case 'C':
        result+=" 8";
    default:
        result+=" 0";
}
document.write(result);

Choices:
- 10
- 0
- 18
- 17


Question:
What will be the output of the following JavaScript code?
function printArray(a)
{
     var len = a.length, i = 0;
     if (len == 0)
        console.log("Empty Array");
     else
     {
         do
         {
             console.log(a[i]);
         } while (++i < len);
     }
}

Choices:
- Prints the numbers in the array in order
- Prints the numbers in the array in the reverse order
- Prints 0 to the length of the array
- Prints “Empty Array”


Question:
What will the following JavaScript code snippet work? If not, what will be the error?
function tail(o)
{
    for (; o.next; o = o.next) ;
    return o;
}

Choices:
- No, this will throw an exception as only numerics can be used in a for loop
- No, this will not iterate
- Yes, this will work
- No, this will result in a runtime error with the message “Cannot use Linked List”


Question:
What will be the role of the continue keyword in the following JavaScript code snippet?
while (a != 0)
{
   if (a == 1)
       continue;
   else
       a++;
}

Choices:
- The continue keyword restarts the loop
- The continue keyword skips the next iteration
- The continue keyword skips the rest of the statements in that iteration
- The continue keyword breaks out of the loop


Question:
What could be the task of the statement debugger in the following JavaScript code?
function f(o)
{
     if (o === undefined) debugger;
}

Choices:
- It does nothing but a simple breakpoint
- It debugs the error in that statement and restarts the statement's execution
- It is used as a keyword that debugs the entire program at once
- It is used to find error in the statement


Question:
What will be the output of the following JavaScript code?
function range(int length)
{
	int a=5;
	for(int i=0;i<length;i++)
	{
		console.log(a);
	}
}
range(3);

Choices:
- 5
- 555
- 3
- error


Question:
What will be the output of the following JavaScript code?
var a = 10;
do {
  	a += 1;
  	console.log(a);
} while (a < 5);

Choices:
- 11121314
- 1112
- 12345
- 11


Question:
What will be the output of the following JavaScript code?
var a= 0;
var b = 0;
while (a < 3)
{
  	a++;
  	b += a;
	console.log(b);
}

Choices:
- 135
- 123
- 013
- 01


Question:
What will be the output of the following JavaScript code?
int size=5;
int a=5;
int size=4;
for(int j=size;j>=0;j--)
{
	console.log(a);
	a=a-2;
}

Choices:
- 5555
- 5321
- 531-1
- 531


Question:
What will be the output of the following JavaScript code?
int a=0;
for(a;a<5;a++);
console.log(a);

Choices:
- 0
- error
- 4
- 5


Question:
What will be the firstname and surname of the following JavaScript code?
var book = {
              "main title": "JavaScript",
              'sub-title': "The Definitive Guide",
              "for": "all audiences",
              author: {
                         firstname: "David",
                         surname: "Flanagan"
                      }
           };

Choices:
- properties
- property values
- property names
- objects


Question:
In the following syntax, the data type within the square brackets must be ___________
book[datatype]=assignment_value;

Choices:
- An integer
- A String
- An object
- Floating point


Question:
What is the prototype represents in the following JavaScript code snippet?
function f() {};

Choices:
- Function f
- A custom constructor
- Prototype of a function
- Not valid


Question:
Identify the process done in the following JavaScript code snippet?
o = {x:1, y:{z:[false,null,""]}};
s = JSON.stringify(o);
p = JSON.parse(s);

Choices:
- Object Encapsulation
- Object Serialization
- Object Abstraction
- Object Encoding


Question:
What will be the output of the following JavaScript code?
const object1 = {};
a = Symbol('a');
b = Symbol.for('b');
object1[a] = 'harry';
object1[b] = 'derry';
const objectSymbols = Object.getOwnPropertySymbols(object1);
console.log(objectSymbols.length);

Choices:
- 0
- 2
- 1
- Error


Question:
What will be the output of the following JavaScript code?
const obj1 =
{
    property1: 21
}
const descriptor1 = Object.getOwnPropertyDescriptor(obj1, 'property1');
console.log(descriptor1.configurable);
console.log(descriptor1.enumerable);

Choices:
- true 21
- true false
- true true
- false false


Question:
What will be the output of the following JavaScript code?
const obj1 = { property1: '10'};
const obj2 = Object.freeze(obj1);
obj2.property1 = '20';
console.log(obj2.property1);

Choices:
- 10
- 20
- Runtime error
- Compilation error


Question:
What will be the output of the following JavaScript code?
const object1 = {
  property1: 20
};
console.log(Object.is(object1));

Choices:
- 20
- true
- false
- error


Question:
What will be the output of the following JavaScript code?
const obj = {prop: 12};
Object.preventExtensions(obj);
console.log( Object.isExtensible(obj));

Choices:
- 12
- false
- true
- error


Question:
What is the observation made in the following JavaScript code?
var count = [1,,3];

Choices:
- The omitted value takes “undefined”
- This results in an error
- This results in an exception
- The omitted value takes an integer value


Question:
What will be the output of the following JavaScript code?
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2

Choices:
- true false
- false true
- true true
- false true


Question:
What is the observation made in the following JavaScript code?
if (!a[i]) continue;

Choices:
- Skips the defined elements
- Skips the existent elements
- Skips the null elements
- Skips the defined & existent elements


Question:
What will be the possible output of the following JavaScript code?
var a = [1,2,3,4,5];
a.slice(0,3);

Choices:
- Returns [1,2,3]
- Returns [4,5]
- Returns [1,2,3,4]
- Returns [1,2,3,4,5]


Question:
What will be the shift() output of the following JavaScript code?
var a = [];
a.unshift(1);
a.unshift(22);
a.shift();
a.unshift(3,[4,5]);
a.shift();
a.shift();
a.shift();

Choices:
- 1
- [4,5]
- [3,4,5]
- Exception is thrown


Question:
What will be the output of the following JavaScript code?
var val1=[1,2,3];
var val2=[6,7,8];
var result=val1.concat(val2);
document.writeln(result);

Choices:
- 1, 2, 3
- Error
- 1, 2, 3, 6, 7, 8
- 123


Question:
What will be the output of the following JavaScript code?
var values=[1,2,3,4]
var ans=values.slice(1);
document.writeln(ans);

Choices:
- 1, 2, 3, 4
- 2, 3, 4
- 1, 3, 4
- error


Question:
What will be the output of the following JavaScript code?
int sum=0;

var arr = [10,15,20,30];

arr.forEach(function myFunction(element)
{
    	sum= sum+element;
});
document.writeln(sum);

Choices:
- 70
- 75
- 10
- error


Question:
What will be the output of the following JavaScript code?
var values=["one","two","Three"];
var ans=values.shift();
document.writeln(ans);

Choices:
- one
- two
- three
- error


Question:
What will be the output of the following JavaScript code?
var arr=[1,2,3];
var rev=arr.reverse();
document.writeln(rev);

Choices:
- 1, 2, 3
- 3, 2, 1
- 3
- 1


Question:
What will be the output of the following JavaScript code?
function printprops(o)
{
    for(var p in o)
      console.log(p + ": " + o[p] + "\n");
}

Choices:
- Prints the contents of each property of o
- Returns undefined
- Prints only one property
- Prints the address of elements


Question:
What will be the equivalent code of the following JavaScript code?
o.m(x,y);

Choices:
- o.m(x) && o.m(y);
- o[“m”](x,y);
- o(m)[“x”,”y”];
- o.m(x && y);


Question:
What will be the output of the following JavaScript code?
function info()
{
    int a=1;
    int b=2;
    return a*b;
}
document.write(info());

Choices:
- 1
- 2
- 3
- error


Question:
What will be the output of the following JavaScript code?
var arr = [7, 5, 9, 1];
var value = Math.max.apply(null, arr);
document.writeln(value);

Choices:
- 7
- 5
- 1
- 9


Question:
What will be the output of the following JavaScript code?
var person =
{
      name: “Rahul”,
      getName: function()
      {
          nreturn this.name;
      }
}
var unboundName = person.getName;
var boundName = unboundName.bind(person);
document.writeln(boundName());

Choices:
- runtime error;
- compilation error
- Rahul
- undefined


Question:
What will be the output of the following JavaScript code?
function code(id,name)
{
  		this.id = id;
  		this.name = name;
}
function pcode(id,name)
{
 		code.call(this,id,name);
}
document.writeln(new pcode(101,"vivek").id);

Choices:
- vivek
- 101
- Runtime error
- Compilation error


Question:
What will be the output of the following JavaScript code?
     var pow=new Function("num1","num2","return Math.pow(num1,num2)");
     document.writeln(pow(2,3));

Choices:
- 2
- 3
- 8
- error


Question:
What will be the output of the following JavaScript statement?
var grand_Total=eval("10*10+5");

Choices:
- 10*10+5
- 105 as a string
- 105 as an integer value
- Exception is thrown


Question:
Will the following JavaScript code work?
var tensquared = (function(x) {return x*x;}(10));

Choices:
- Yes, perfectly
- Error
- Exception will be thrown
- Memory leak


Question:
What will be the output of the following JavaScript code?
var string2Num=parseInt("123xyz");

Choices:
- 123
- 123xyz
- Exception
- NaN


Question:
What will be the equivalent statement of the following JavaScript statement?
var o = new Object();

Choices:
- var o = Object();
- var o;
- var o= new Object;
- Object o=new Object();


Question:
What is the difference between the two lines in the following JavaScript code?
!!(obj1 && obj2);
(obj1 && obj2);

Choices:
- Both the lines result in a boolean value “True”
- Both the lines result in a boolean value “False”
- Both the lines check just for the existence of the object alone
- The first line results in a real boolean value whereas the second line merely checks for the existence of the objects


Question:
What will be the state stored in d in the following JavaScript code?
var c = counter(), d = counter();
c.count()
d.count()
c.reset()
c.count()
d.count()

Choices:
- 1
- 0
- Null
- Undefined


Question:
What will be the last statement return in the following JavaScript code?
function constfuncs()
{
    var funcs = [];
    for(var i = 0; i < 10; i++)
        funcs[i] = function() { return i; };
    return funcs;
}
var funcs = constfuncs();
funcs[5]()

Choices:
- 9
- 0
- 10
- 12


Question:
What will be the output of the following JavaScript code?
var arr = [7, 5, 9, 1];
var min = Math.min.apply(null, arr);
document.writeln(min);

Choices:
- 7
- 5
- 1
- 9


Question:
What will be the output of the following JavaScript code?
var add=new Function("num1","num2","return num1+num2");
document.writeln(add(2,5));

Choices:
- 2
- 5
- Error
- 7


Question:
What will be the output of the following JavaScript code?
var a=3.7;
var b=2;
a=ciel(a)
document.writeIn(a*b);

Choices:
- 6
- 7.4
- 7.5
- 8


Question:
What will be the output of the following JavaScript code?
var a=2.99;
var ans=floor(a)*floor(a)
console.log(ans);

Choices:
- 9
- 8.31
- Error
- 4


Question:
What will be the output of the following JavaScript code?
var a=225;
document.writeln(Math.sqrt(a));

Choices:
- 225
- 15
- Error
- Undefined


Question: What will be the output of the following JavaScript code?

Choices:
- 0.80
- 0.88
- 0.50
- 0.78


Question: What will be the output of the following JavaScript code?

Choices:
- 1.00
- 1.01
- 1.05
- 1.10


Question:
What will be the function of the following JavaScript code?
var scope = "global scope";
function checkscope()
{
    var scope = "local scope";
    function f()
    {
         return scope;
    }
    return f;
}

Choices:
- Returns value null
- Returns exception
- Returns the value in scope
- Shows an error message


Question:
What will be the output of the following JavaScript code?
var o = new F();
o.constructor === F

Choices:
- false
- true
- 0
- 1


Question:
What will be the output of the following JavaScript code?
const obj1 =
{
  	a: 10,
  	b: 15,
  	c: 18
};
const obj2 = Object.assign({c: 7, d: 1}, obj1);
console.log(obj2.c, obj2.d);

Choices:
- 7,1
- 18,1
- Undefined
- Error


Question:
What will be the output of the following JavaScript code?
function person()
{
        this.name = 'rahul';
}
function obj()
{
       obj.call(this)
}
obj.prototype = Object.create(person.prototype);
const app = new obj();
console.log(app.name);

Choices:
- undefined
- runtime error
- compilation error
- rahul


Question:
What will be the output of the following JavaScript code?
const object1 = {};
Object.defineProperties(object1,
{
  	property1:
        {
             value: 10
        }
 });
console.log(object1.property1);

Choices:
- 0
- 10
- undefined
- error


Question:
What will be the output of the following JavaScript code?
const prototype1 = {};
const object1 = Object.create(prototype1);
console.log(Object.getPrototypeOf(object1) === prototype1);

Choices:
- true
- false
- error
- 0


Question:
What will be the output of the following JavaScript code?
const obj1 = {
  property1: 2
};
Object.seal(object1);
obj1.property1 =4;
console.log(obj1.property1);
delete obj1.property1;

Choices:
- 2
- 4
- Error
- Undefined


Question:
What will be the output of the following JavaScript code?
   emp={id:102,name:"Shyam Kumar",salary:40000}
   document.write(emp.id+" "+emp.name+" "+emp.salary);

Choices:
- 102 4000 Shyam Kumar
- 102 4000
- 102 Shyam Kumar 40000
- 102 shyam kumar 40000


Question:
What will be the output of the following JavaScript code?
function emp(id,name)
{
    this.id=id;
    this.name=name;
}
e=new emp(103,"Vimal Jaiswal");

document.write(e.id+" "+e.name");

Choices:
- 103 vimal jaiswal
- 103
- 103  Vimal Jaiswal
- Vimal jaiswal


Question:
What will be the output of the following JavaScript code?
var emp=new Object();
emp.name="Ravi Malik";
emp.salary=50000;
document.write("emp.name+" "+emp.salary);

Choices:
- Ravi malik 5000
- Ravi Malik 50000
- Ravi malik
- 50000


Question:
What will be the output of the following JavaScript code?
function emp(name,salary)
{
     this.name=name;
     this.salary=salary;

     this.changeSalary=changeSalary;
     function changeSalary(programming-languagesalary)
     {
         this.salary=programming-languagesalary;
     }
}
e=new emp("Rahul",30000);
e.changeSalary(45000);
document.write("e.name+" "+e.salary);

Choices:
- Rahul 30000
- Rahul
- Rahul 45000
- 45000


Question:
What will be the output of the following JavaScript code?
const obj = { 10: 'arry', 21: 'barry', 23: 'carry' };
console.log(Object.entries(obj)[2]);

Choices:
- [“arry”, “10”]
- [“10”,”arry”]
- [“21”,barry”]
- [“23”,”carry”]


Question:
What will be the efficiency quotient of the following JavaScript statements?
var Set = sets.Set;
var s = new Set(1,2,3);

Choices:
- The programmer imports at once the frequently used values into the global namespace
- There is no efficiency quotient, the programmer tries to make it inefficient
- The programmer needs to import the Sets everytime he wants to use it
- the programmer imports the set everytime the statement is  encountered


Question:
What could be achieved by running the JavaScript code snippet below?
var sets = com.davidflanagan.collections.sets;

Choices:
- Importing a single module
- Importing a module partially
- Importing a namespace
- Importing the entire module


Question: What will be the output of the following JavaScript code?

Choices:
- 0.0123
- 12300
- Error
- Undefined


Question: What will be the output of the following JavaScript code?

Choices:
- 3
- true
- false
- error


Question: What will be the output of the following JavaScript code?

Choices:
- 3
- true
- false
- error


Question: What will be the output of the following JavaScript code?

Choices:
- True
- False
- Error
- Undefined


Question: What will be the output of the following JavaScript code?

Choices:
- true
- false
- error
- undefined