0

programming languages Online Quiz - 139

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

What happen if the exception is not caught?

  1. nothing happen, excution will continue.

  2. it will be handled by compiler, and excution stops.

  3. the exception will be rethrown

  4. terminate() function will be called and execution stops.


Correct Option: D
  1. try {throw 3;} catch(int i){ rethrow; }

  2. try {throw 3; rethrow ;} catch(int i){}

  3. try {throw 3;} catch(int i){ rethrow 3; }

  4. try {throw 3;} catch(int i){ throw; }


Correct Option: D

range_error is which type of exception.

  1. logical_error

  2. runtime_error

  3. domain_error

  4. bad_exception


Correct Option: B

Which of the following is used for casting inherently incompatible pointers.

  1. static_cast

  2. reinterpret_cast

  3. dynamic_cast

  4. const_cast


Correct Option: B

which of the following is not an associative container

  1. map

  2. multiset

  3. priority queue

  4. multimap


Correct Option: C

which of the following iterator must support *, ==, =- and ++ operations

  1. Input Iterator

  2. Output Iterator

  3. Forward Iterator

  4. None of these


Correct Option: C

Which company first implemented the JavaScript language?

  1. Microsoft Corp.

  2. Netscape Communications Corp.

  3. Sun Microsystems Corp.

  4. Consortium of the above companies


Correct Option: B
  1. Comments can make the code easier to understand.

  2. Comments can help hide the code from browsers that cannot interpret JavaScript.

  3. Comments can help display a warning to users of old browsers that do not support JavaScript.

  4. All of above.


Correct Option: D

he original name of JavaScript was

  1. JavaScript

  2. LiveScript

  3. WireScript

  4. ECMAScript


Correct Option: B
  1. Microsoft Internet Explorer 2.0 beta

  2. Netscape Navigator 2.0 beta

  3. Opera 2.0 beta

  4. SunSoft HotJava 2.0 beta


Correct Option: B
  1. Microsoft Internet Explorer 3.02

  2. Netscape Navigator 3.02

  3. Opera 3.51

  4. SunSoft HotJava 1.0


Correct Option: D
  1. JavaScript 1.3 Standard

  2. ISO-262 Standard

  3. IEEE-262 Standard

  4. None of the above


Correct Option: D
  1. JavaScript is DHTML plus CSS plus Document Object Model.

  2. DHTML is Document Object Model plus JavaScript plus CSS.

  3. Document Object Model is JavaScript plus DHTML plus CSS.

  4. JavaScript has nothing to do with DHTML.


Correct Option: B

Given: public class Pass { public static void main(String [] args) { int x 5; Pass p = new Pass(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuff x = “+ x++); } } What is the result?

  1. doStuffx = 5 main x = 5

  2. Compilation fails.

  3. doStuffx = 6 main x = 5

  4. An exception is thrown at runtime

  5. doStuffx = 6 main x = 6


Correct Option: A

Given: 1. package sun.scjp; 2. public enum Color { RED, GREEN, BLUE } 1. package sun.beta; 2. // insert code here 3. public class Beta { 4. Color g = GREEN; 5. public static void main( String[] argv) 6. { System.out.println( GREEN); } 7. } The class Beta and the enum Color are in different packages. Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?

  1. import sun.scjp.; import static sun.scjp.Color.;

  2. import sun.scjp.Color; import static sun.scjp.Color.*;

  3. import sun.scjp.Color.*;

  4. import sun.scjp.Color; import static sun.scjp.Color.GREEN;


Correct Option: B,D

Class TestException 1. public class TestException extends Exception { 2. } Class A: 1. public class A { 2. 3. public String sayHello(String name) throws TestException { 4. 5. if(name == null) { 6. throw new TestException(); 7. } 8. 9. return “Hello “+ name; 10. } 11. 12. } A programmer wants to use this code in an application: 45. A a=new A(); 46. System.out.println(a.sayHello(”John”)); Which are true?

  1. Line 46 will compile if the enclosing method throws a TestException.

  2. Class A will not compile.

  3. Line 46 will compile if enclosed in a try block, where TestException is caught

  4. Line 45 can throw the unchecked exception TestException.


Correct Option: A,C
- Hide questions