0

programming languages Online Quiz - 300

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

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

What will happen when you attempt to compile and run the following code? (Assume that the code is compiled and run with assertions enabled.) public class AssertTest { public void methodA(int i) { assert i >= 0 : methodB(); System.out.println(i); } public void methodB() { System.out.println("The value must not be negative"); } public static void main(String args[]) { AssertTest test = new AssertTest(); test.methodA(-10); } }

  1. It will print -10

  2. It will result in Assertion Error showing the message -"The value must not be negative".

  3. The code will not compile.

  4. None of these.


Correct Option: C

What will happen when you attempt to compile and run the following code? interface MyInterface { } public class MyInstanceTest implements MyInterface { static String s; public static void main(String args[]) { MyInstanceTest t = new MyInstanceTest(); if(t instanceof MyInterface) { System.out.println("I am true interface"); } else { System.out.println("I am false interface"); } if(s instanceof String) { System.out.println("I am true String"); } else { System.out.println("I am false String"); } } }

  1. Prints : "I am false interface" followed by " I am false String"

  2. Prints : "I am true interface" followed by " I am true String"

  3. Prints : "I am true interface" followed by " I am false String"

  4. Compile-time error


Correct Option: C

What will happen when you attempt to compile and run the following code? public class Static { static { int x = 5; } static int x,y; public static void main(String args[]) { x--; myMethod(); System.out.println(x + y + ++x); } public static void myMethod() { y = x++ + ++x; } }

  1. Compile-time error

  2. prints : 3

  3. prints : 1

  4. prints : 7


Correct Option: B

Given the following code, what will be the output? class Value { public int i = 15; } public class Test { public static void main(String argv[]) { Test t = new Test(); t.first(); } public void first() { int i = 5; Value v = new Value(); v.i = 25; second(v, i); System.out.println(v.i); } public void second(Value v, int i) { i = 0; v.i = 20; Value val = new Value(); v = val; System.out.println(v.i + " " + i); } }

  1. 15 0 20

  2. 15 0 15

  3. 20 0 20

  4. 0 15 20


Correct Option: A

What will be output of this program? String str="TCS"; str.concat("Bangalore");

  1. TCS

  2. Bangalore

  3. TCS Bangalore

  4. Syntax Error


Correct Option: A

A ____________is a collection that associates a key object with a value object.

  1. Array

  2. List

  3. Map

  4. Vector


Correct Option: C
  1. serialization support

  2. platform independent

  3. object diagnostic output

  4. run-time class information


Correct Option: A,C,D

The MFC library implements a Windows menu, from the Win32’s HMENU class, through the CMenu class

  1. True

  2. False


Correct Option: A
  1. afxdlg.h header file.

  2. afxdlgs.h header file

  3. afxprp.h header file

  4. afxproppg.h header file


Correct Option: B
- Hide questions