programming languages Online Quiz - 296
Description: programming languages Online Quiz - 296 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Given: 1. public interface A { 2. String DEFAULT_GREETING = “Hello World”; 3. public void method1(); 4. } A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?
Given: 1. interface TestA { String toString(); } 2. public class Test { 3. public static void main(String[] args) { 4. System.out.println(new TestA() { 5. public String toString() { return “test”; } 6. }); 7. } 8. } What is the result?
Given: 10. interface Data { public void load(); } 11. abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?
public class xyz { public static void main(String args[]) { for(int i = 0; i < 2; i++) { for(int j = 2; j>= 0; j--) { if(i == j) break; System.out.println("i=" + i + " j="+j); } } } } A) i=0 j=0 B) i=0 j=1 C) i=0 j=2 D) i=1 j=0 E) i=1 j=1 F) i=1 j=2 G) i=2 j=0 H) i=2 j=1 I) i=2 j=2
Select the one correct answer. Which method defined in Integer class can be used to convert an Integer object to primitive int type. A) valueOf B) intValue C) getInt D) getInteger
public class test { public static void main(String args[]) { int i=1, j=1; try { i++; j--; if(i == j) i++; } catch(ArithmeticException e) { System.out.println(0); } catch(ArrayIndexOutOfBoundsException e) { System.out.println(1); } catch(Exception e) { System.out.println(2); } finally { System.out.println(3); } System.out.println(4); } } A) 0 B) 1 C) 2 D) 3 E) 4
In which all cases does an exception gets generated. Select the two correct answers. int i = 0, j = 1;
What would be the output of the following program? main() { char *str[] = {"Frogs","Do","Not","Die.","They",'Croak!"}; printf("%d %d",sizeof(str),sizeoof(str[0])); }
What would be the output of the following program? main() { static int a[20]; int i =0 ; a[i]=i++; printf("\n%d %d %d",a[0],a[1],i); }
The maximum combined length of the command line arguments including the spaces between adjacent arguments is