0
Alien head

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

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

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

  1. 0

  2. 1

  3. 2

  4. 3


Correct Option: B

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

println exhibits which type of polymorphism

  1. Overloading

  2. Overriding

  3. Both 1 and 2

  4. Dynamic polymorphism


Correct Option: A

What is the rule regarding overriding methods throwing exceptions?

  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

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

Which one is not correct A. x = = Float.NaN B. Float.isNan(x); C. Myobject .equals(float.NaN);

  1. A

  2. B

  3. Both

  4. None of these


Correct Option: B

main method can be overridden.. True/False

  1. True

  2. False


Correct Option: B

static methods can be overridden. True/False

  1. True

  2. False


Correct Option: B

Which one of these statements are valid? Char \u0061r a =’a’; Char \u0062 = ’b’; Char c =’\u0063’Which one is not correct A. x = = Float.NaN B. Float.isNan(x); C. Myobject .equals(float.NaN);

  1. A

  2. B

  3. C

  4. All


Correct Option: D

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

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

  1. True

  2. False


Correct Option: A

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

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

  1. True

  2. False


Correct Option: B

Is the following statement correct: char ch = 'd'; if(ch < 32.00){ }

  1. True

  2. False


Correct Option: A

Final variables declared without initialization can be initialized in static initializer ( static final var) or in constructor( final var). True/False?

  1. True

  2. False


Correct Option: A

Java Polymorphism

  1. True

  2. False


Correct Option: B

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

  1. True

  2. False


Correct Option: B

Is Array operations are faster than Vector.

  1. True

  2. False


Correct Option: A

Which of the following servlet methods can return null?

  1. getInitParameterNames()

  2. getInitParameter(String name)

  3. getServletName()

  4. getServletContext()


Correct Option: B
+ View questions