0

programming languages Online Quiz - 279

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

Which of the following servlet methods can return null?

  1. getInitParameterNames()

  2. getInitParameter(String name)

  3. getServletName()

  4. getServletContext()


Correct Option: B

Is Array operations are faster than Vector.

  1. True

  2. False


Correct Option: A

Does File class have any method to read or write content in a file?

  1. True

  2. False


Correct Option: B

If there is an exception in finalize method, will the object be garbage collected?

  1. True

  2. False


Correct Option: B

If you have reference variable of parent class type and you assign a child class object to that variable and invoke static method. Which method will be invoked? Parent/Child.

  1. Parent

  2. Child

  3. Both

  4. None of these


Correct Option: A

Can we declare derived class first and then base class in java?

  1. True

  2. False


Correct Option: A

byte b; final int a = 10; final int x = a; b = x; System.out.println("The value of b is " + b);

  1. Compilation error

  2. Runtime Error

  3. 10

  4. None of these


Correct Option: C

main method can be overridden.. True/False

  1. True

  2. False


Correct Option: B

Which is true about overloading?

  1. return type should be different

  2. access speciifer should be different

  3. arguments should be different

  4. the overloaded methods should throw a different excpetion


Correct Option: C
  1. Overriding method can not throw more generic exception than base method

  2. Overriding method can throw new or broader checked exceptions

  3. None of the above

  4. Both a and b


Correct Option: A
  1. Overloading

  2. Overriding

  3. Both 1 and 2

  4. Dynamic polymorphism


Correct Option: A

void main() { unsigned int x=-1; int y; y = ~0; if(x == y) printf("same"); else printf("not same"); }

  1. not same

  2. same

  3. unknown symbol ‘~’

  4. none of the above


Correct Option: B

f1(int c) { printf("%d", c); } void main() { int a=1; f1(a++); }

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B

main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p\t%p\t%p",p,q,r); }

  1. 0001 0002 0003

  2. compile error

  3. 0001 0002 0004

  4. 0001 0002 0006


Correct Option: C
- Hide questions