0

programming languages Online Quiz - 296

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

Given: 11. public abstract class Shape { 12. int x; 13. int y; 14. public abstract void draw(); 15. public void setAnchor(int x, int y) { 16. this.x = x; 17. this.y = y; 18. } 19. } and a class Circle that extends and fully implements the Shape class. Which is correct?

  1. Shape s = new Shape(); s.setAnchor(10,10); s.draw();

  2. Circle c = new Shape(); c.setAnchor(10,10); c.draw();

  3. Shape s = new Circle(); s.setAnchor(10,10); s.draw();

  4. Shape s = new Circle(); s->setAnchor(10,10); s->draw();


Correct Option: C
  1. . public class Employee extends Info implements Data { public void load() { /do something/ }

  2. public class Employee implements Info extends Data { public void load() { /do something/ }

  3. public class Employee extends Info implements Data { public void load() { /*do something */ }

  4. public class Employee implements Info extends Data { public void Data.load() { /*d something */ }


Correct Option: A
  1. public class Circle implements Shape { private int radius;

  2. public abstract class Circle extends Shape { private int radius;

  3. public class Circle extends Shape {

  4. public abstract class Circle implements Shape {


Correct Option: B,C

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

  1. B,C

  2. A,I,F

  3. B,C,F

  4. None of the above


Correct Option: C

What is the result of evaluating the expression 14 ^ 23. Select the one correct answer. A) 25 B) 37 C) 6 D) 31 E) 17 F) 9 G) 24

  1. B

  2. A

  3. D

  4. E


Correct Option: B

Is the following statement true or false. As the toString method is defined in the Object class, System.out.println can be used to print any object.

  1. True

  2. False


Correct Option: A

In which all cases does an exception gets generated. Select the two correct answers. int i = 0, j = 1;

  1. if((i == 0) || (j/i == 1))

  2. if((i == 0) | (j/i == 1))

  3. if((i != 0) && (j/i == 1))

  4. if((i != 0) & (j/i == 1))


Correct Option: B,D

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); }

  1. 1 0 1

  2. 0 0 1

  3. 1 2 3

  4. Compile error


Correct Option: B

The maximum combined length of the command line arguments including the spaces between adjacent arguments is

  1. 128 characters

  2. 256 characters

  3. 67 characters

  4. It may vary from one operating system to another


Correct Option: D
- Hide questions