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

Which of the following represents the correct syntax for re-throwing an exception.

  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

What is time complexity of Insertions or deletions at positions other than the end in "vector STL template class"

  1. O(1)

  2. O(N2)

  3. O(log N)

  4. O(N)


Correct Option: D

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

What are the purposes of comments in JavaScript code?

  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

When was the first release of a browser supporting JavaScript?

  1. 1995

  2. 1996

  3. 1997

  4. 1998


Correct Option: A

he original name of JavaScript was

  1. JavaScript

  2. LiveScript

  3. WireScript

  4. ECMAScript


Correct Option: B

Which of the following browsers was the first to support JavaScript?

  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

Which of the following browsers does not support JavaScript?

  1. Microsoft Internet Explorer 3.02

  2. Netscape Navigator 3.02

  3. Opera 3.51

  4. SunSoft HotJava 1.0


Correct Option: D

The JavaScript international standard is called

  1. JavaScript 1.3 Standard

  2. ISO-262 Standard

  3. IEEE-262 Standard

  4. None of the above


Correct Option: D

AI Explanation

To answer this question, you need to be familiar with the JavaScript international standard.

Option A) JavaScript 1.3 Standard - This option is incorrect because there is no JavaScript 1.3 Standard. JavaScript has evolved over time, and the current version is ECMAScript 2021.

Option B) ISO-262 Standard - This option is incorrect because there is no ISO-262 Standard for JavaScript. ISO (International Organization for Standardization) standards cover various industries and technologies, but JavaScript does not have a specific ISO standard.

Option C) IEEE-262 Standard - This option is incorrect because there is no IEEE-262 Standard for JavaScript. IEEE (Institute of Electrical and Electronics Engineers) standards also cover a wide range of technologies, but JavaScript does not have a dedicated IEEE standard.

Option D) None of the above - This option is correct because there is no specific JavaScript international standard called JavaScript 1.3 Standard, ISO-262 Standard, or IEEE-262 Standard.

The correct answer is D. None of the above.

Which of the following statements best describes the relationship between JavaScript and DHTML?

  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
Explanation:

To answer this question, the user needs to have a basic understanding of JavaScript and DHTML.

JavaScript is a programming language used to create interactive effects on web pages. DHTML stands for Dynamic HTML, which is a combination of HTML, CSS, and JavaScript used to create dynamic web content.

Now, let's evaluate each option to determine the correct answer:

A. JavaScript is DHTML plus CSS plus Document Object Model. This statement is incorrect as DHTML is the combination of HTML, CSS, and JavaScript. JavaScript is an integral part of DHTML, not an addition to it.

B. DHTML is Document Object Model plus JavaScript plus CSS. This statement is correct. DHTML is the combination of HTML, CSS, and JavaScript used to create dynamic web content. The Document Object Model (DOM) is a programming interface for HTML and XML documents, and it is used by JavaScript to modify the content and structure of web pages.

C. Document Object Model is JavaScript plus DHTML plus CSS. This statement is incorrect as JavaScript is a part of DHTML, not the other way around. The DOM is used by JavaScript to modify DHTML, not the other way around.

D. JavaScript has nothing to do with DHTML. This statement is incorrect. JavaScript is an essential part of DHTML and is used to create dynamic web content.

Therefore, the correct answer is:

The Answer is: B. DHTML is Document Object Model plus JavaScript plus CSS.

Which JavaScript version was the first to allow image swapping, or image roll-overs?

  1. JavaScript 1.0

  2. JavaScript 1.1

  3. JavaScript 1.2

  4. JavaScript 1.3


Correct Option: B

AI Explanation

To answer this question, we need to understand the history of JavaScript and its features.

Image swapping, or image roll-overs, refer to the ability to change an image when a user interacts with it, such as hovering over it with a mouse. This functionality is commonly used in web development to enhance user experience.

The correct answer is B) JavaScript 1.1. This version of JavaScript introduced the onmouseover and onmouseout events, which allowed developers to create image roll-over effects. The onmouseover event is triggered when the mouse pointer is moved over an element, while the onmouseout event is triggered when the mouse pointer is moved away from an element.

Option A) JavaScript 1.0 - This option is incorrect because JavaScript 1.0 did not have the capabilities to handle image swapping or roll-over effects.

Option C) JavaScript 1.2 - This option is incorrect because JavaScript 1.2 did not introduce any new features related to image swapping or roll-overs.

Option D) JavaScript 1.3 - This option is incorrect because JavaScript 1.3 did not introduce any new features related to image swapping or roll-overs.

Therefore, the correct answer is B) JavaScript 1.1, as it was the first version to allow image swapping or roll-over effects.

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

Given: class TestA { public void start() { System.out.println(”TestA”); } } public class TestB extends TestA { public void start() { System.out.println(”TestB”); } public static void main(String[] args) { ((TestA)new TestB()).start(); } } What is the result?

  1. Compilation fails.

  2. TestB

  3. TestA

  4. An exception is thrown at runtime


Correct Option: B

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