0

programming languages Online Quiz - 24

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

Can you inherit multiple interfaces?

  1. True

  2. False


Correct Option: A

What does the keyword virtual mean in the method definition?

  1. The method is public

  2. The method can be derived

  3. The method is static

  4. The method can be over-ridden


Correct Option: D

________________ refers to formatting data based on locale?

  1. Globalization

  2. Localization

  3. Impersonation

  4. Unicode program


Correct Option: A

Is it possible to store multiple data types in System.Array?

  1. True

  2. False


Correct Option: B

Do finally block get executed if the exception had not occurred?

  1. True

  2. False


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) True - This option is correct. The finally block is always executed, regardless of whether an exception occurred or not. It is typically used to release resources or perform cleanup actions that need to be done regardless of the outcome of the try-catch block.

Option B) False - This option is incorrect. The finally block is always executed, even if an exception did not occur.

The correct answer is A) True. This option is correct because the finally block will be executed regardless of whether an exception occurred or not.

Java allows multiple inheritance through

  1. Class

  2. Interface

  3. None

  4. Thread


Correct Option: B

Parameter passing in java is pass by reference

  1. True

  2. False


Correct Option: B

static public class Test { public static void main(String[] args) { char c = 'a'; switch(c){ case 65: System.out.println("one");break; case 'a': System.out.println("two");break; case 3: System.out.println("three"); } } }

  1. one

  2. two

  3. Compile error - char can't be permitted in switch statement

  4. Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted


Correct Option: D

What is the result of executing the following code, using the parameters 0 and 3 ?public void divide(int a, int b) { try { int c = a / b; } catch (Exception e) { System.out.print("Exception "); } finally { System.out.println("Finally");}

  1. Prints out: Exception Finally

  2. Prints out: Finally

  3. Prints out: Exception

  4. Compile with error


Correct Option: B

AI Explanation

To answer this question, let's go through the code and analyze its execution:

The given code defines a method called divide that takes two parameters a and b. Inside the method, there is a try-catch-finally block.

  1. The code inside the try block attempts to divide a by b and assigns the result to c. However, since the code doesn't do anything with c, this operation is unnecessary.

  2. If an exception occurs during the division (e.g., if b is 0), the catch block will catch the exception and execute the code inside it. In this case, it prints "Exception ".

  3. After the try-catch block, the code inside the finally block will always execute, regardless of whether an exception occurred or not. In this case, it prints "Finally".

Now, let's analyze the options:

Option A) Prints out: Exception Finally - This option is incorrect because it suggests that both "Exception" and "Finally" will be printed. However, only "Finally" will be printed because no exception will occur.

Option B) Prints out: Finally - This option is correct. In the given code, since no exception occurs, only "Finally" will be printed.

Option C) Prints out: Exception - This option is incorrect because "Exception" will only be printed if an exception occurs during the division. In this case, no exception occurs.

Option D) Compile with error - This option is incorrect because the code will compile without any errors.

The correct answer is B) Prints out: Finally. This option is correct because the finally block will always execute, regardless of whether an exception occurred or not.

Which of the below statement is true about Error?

  1. An Error is a subclass of Throwable

  2. An Error is a subclass of Exception

  3. Error indicates serious problems that a reasonable application should not try to catch.

  4. An Error is a subclass of IOException


Correct Option: A,C

What is the output for the below code ? public class Test { public static void main(String[] args) { Integer i = null; int j = i; System.out.println(j); } }

  1. 0

  2. Compile with error

  3. null

  4. NullPointerException


Correct Option: D

Visual Basic is a

  1. Data Oriented Language

  2. Service Oriented Language

  3. Object Oriented Language

  4. Structured Oriented Language


Correct Option: C

Which keyword is used to prevent the values being changed?

  1. Static

  2. Const

  3. Preserve

  4. ReadOnly


Correct Option: B

Complete the code. Sub Demo() X = 4 Y = 5 Z = addNum(X,Y) Msgbox (Z) End Sub Function addNum(X,Y) Ans = X + Y <> End Function

  1. Return (Ans)

  2. Return Ans

  3. addNum = Ans

  4. addNum = Return Ans


Correct Option: C

Which window is used to show the values of variables that are in your code?

  1. Breakpoints

  2. Immediate window

  3. Properties window

  4. Watches window


Correct Option: D

What is the shortcut key to open the VB macro from excel?

  1. Alt + F11

  2. Alt + F10

  3. Ctrl + F10

  4. Alt + F8


Correct Option: A

1.Which tag is must for compilation of mxml file?

  1. Box

  2. Application

  3. Button

  4. Panel


Correct Option: B

2.Which two languages are used in Flex?

  1. Java & C

  2. mxml & as

  3. C & C

  4. java & javascript.


Correct Option: B

Can we create custom components ?

  1. Yes

  2. No

  3. Don't know

  4. No Idea


Correct Option: A
- Hide questions