0
Alien head

programming languages Online Quiz - 21

Description: programming languages Online Quiz - 21
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

public class test08 { public static void main(String[] args) { System.out.print("H" + "a"); System.out.print('H' + 'a'); } } What is the output?

  1. HaHa

  2. Ha

  3. Compile error

  4. None of the above


Correct Option: D

class A{ public void show(){ System.out.println("This is A"); } class B extends A{ protected void show(){ System.out.println("This is B"); } public class Main{ public static void main(String[] args) { A a = new B(); a.show(); } } What is the output

  1. This is A

  2. This is B

  3. Nothing will be printed as output

  4. None of the above


Correct Option: D

public class test08 { public static void main(String[] args) { final int start = Integer.MAX_VALUE - 100; final int end = Integer.MAX_VALUE; int count = 0; for (int i = start; i <= end; i++) count++; System.out.println(count); } } What will be the output

  1. 100

  2. 101

  3. 102

  4. None of the above


Correct Option: D

public class Change { public static void main(String args[]) { System.out.println(2.00 - 1.10); } } What is the output

  1. 0.9

  2. 0.90

  3. It varies

  4. None of the above


Correct Option: D

By default any class would be supplied with?

  1. Constructor

  2. Destructor

  3. Overloaded assignment operator

  4. Default Copy Constructor


Correct Option: A,B,C,D

interface my_interface{ public void show(); } public class test08 { public static void main(String[] args) { my_interface mi = new B(); mi.show(); } } class A implements my_interface{ public void show(){ System.out.println("This is implemented method "); } } class B extends A{ public void show(){ System.out.println("This is overrided method "); } } What is the output

  1. This is implemented method

  2. This is overrided method

  3. Compile time Error

  4. Run time error


Correct Option: B

Is it possible to have a virtual destructor?

  1. True

  2. False


Correct Option: A

What gets printed on the standard output when the class below is compiled and executed. Select the one correct answer. public static ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t && ((i++) == 0)); b = (f && ((i+=2) > 0)); System.out.println(i); } }

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B

Which of these are not legal identifiers. Select all the correct answers.

  1. 1alpha

  2. _abcd

  3. xy+abc

  4. transient

  5. account-num

  6. very_long_name


Correct Option: A,C,D,E

Which of the following statements are true

  1. When you construct an instance of File, if you do not use the filenaming semantics of the local machine, the constructor will throw an IOException.

  2. When you construct an instance of File, if the corresponding file does not exist on the local file system, one will be created.

  3. When an instance of File is garbage collected, the corresponding file on the local file system is deleted.

  4. None of the above.


Correct Option: A,B,C

What does the following paint( ) method draw?

  1. A circle at (100, 100) with radius of 44

  2. A circle at (100, 44) with radius of 100

  3. A circle at (100, 44) with radius of 44

  4. The code does not compile


Correct Option: D

If you run the code below, what gets printed out? String s=new String("Bicycle"); int iBegin=1; char iEnd=3; System.out.println(s.substring(iBegin,iEnd));

  1. Bic

  2. ic

  3. icy

  4. error: no method matching substring(int,char)


Correct Option: B

x=[1,2,3,4,5] x[3:3]='sagar' print x

  1. error

  2. [1,2,3,4,'sagar',5]

  3. [1,2,3,'sagar']

  4. none


Correct Option: B

x=[1,2,3,4,5] print x[-1]

  1. error

  2. 5

  3. garbage number

  4. 3


Correct Option: B

a=['a','b'] x=[a,'y']

  1. x[0][0]

  2. Syntax error at line 1

  3. Syntax error at line 2

  4. runtime error


Correct Option: A

name=[1]*3

  1. [11]

  2. syntax error

  3. [1,1,1]

  4. runtime error


Correct Option: C

Python lists are mutable

  1. True

  2. False


Correct Option: A

Is Abstract Class is Parent Class of ArrayList?

  1. True

  2. False


Correct Option: A

what a Clone method returns in ArrayList?

  1. Returns String

  2. Returns an Array

  3. Returns a shallow copy of this ArrayList instance

  4. Returns Void


Correct Option: C

By using which method ,How can one increase size of an ArrayList?

  1. incSize(int minCapacity)

  2. ensureCapacity(int minCapacity)

  3. incCapicity(int minCapacity)

  4. All of the Above


Correct Option: B
+ View questions