0

programming languages Online Quiz - 151

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

Parameter entities can appear in

  1. xml file

  2. dtd file

  3. xsl file

  4. Both 1 and 2


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of parameter entities and where they can appear.

Parameter entities are used in Document Type Definitions (DTD) files to define reusable pieces of markup. They are used to make the DTD more modular and easier to maintain.

Option A) xml file - Parameter entities cannot appear in XML files. XML files are used to store and transport data, and they do not support the use of parameter entities.

Option B) dtd file - This option is correct. Parameter entities can appear in DTD files. DTD files are used to define the structure and constraints of an XML document, and parameter entities are used to define reusable parts of the DTD.

Option C) xsl file - Parameter entities cannot appear in XSL files. XSL files are used for transforming XML documents into other formats (such as HTML or PDF), and they do not support the use of parameter entities.

Option D) Both 1 and 2 - This option is incorrect. Parameter entities can only appear in DTD files (option 2), not in XML files (option 1).

Therefore, the correct answer is B) dtd file.

  1. eXtra Modern Link

  2. eXtensible Markup Language

  3. Example Markup Language

  4. X-Markup Language


Correct Option: B
  1. Direct Type Definition

  2. Document Type Definition

  3. Do The Dance

  4. Dynamic Type Definition


Correct Option: B

When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the method.

  1. True

  2. False


Correct Option: A

A static method can refer to any instance variable of the class.

  1. True

  2. False


Correct Option: B

Methods can be overloaded with a difference only in the type of the return variable.

  1. True

  2. False


Correct Option: B

All interface methods must be declared as public when implemented in a class.

  1. True

  2. False


Correct Option: A

All interface methods must be declared as public when implemented in a class.

  1. True

  2. False


Correct Option: A
  1. Compilation error, attempting to perform binary comparison on logical data type.

  2. Compilation and output of "We are equal 10".

  3. Compilation and output of "Not equal! 20".

  4. Compilation and output of "Not equal! 10".


Correct Option: D

Jasper report does not allow to hide column dynamically.

  1. True

  2. False


Correct Option: B

Is it possible to embed a Jasper report in to another Jasper Report?

  1. True

  2. False


Correct Option: B
  1. JRPrint file

  2. Jasper file

  3. html file

  4. None of the above


Correct Option: B

Is it possible to embed a image in jasper Reports?

  1. True

  2. False


Correct Option: B

What results from attempting to compile and run the following code? public class Ternary { public static void main(String args[]) { int a = 5; System.out.println("Value is - " + ((a < 5) ? 9.9 : 9)); } }

  1. prints: Value is - 9

  2. prints: Value is - 5

  3. Compilation error

  4. None of these


Correct Option: D

Considering the following code, Which variables may not be referenced correctly at line 12? 1. public class Outer 2. { 3. public int a = 1; 4. private int b = 2; 5. public void method(final int c) 6. { 7. int d = 3; 8. class Inner 9. { 10. private void iMethod(int e) 11. { 12. 13. } 14. } 15. } 16. }

  1. a

  2. d

  3. c

  4. b


Correct Option: B

AI Explanation

To determine which variables may not be referenced correctly at line 12, let's analyze the code.

In the given code, there is an outer class called Outer and a method called method within it. Inside the method, there is a nested class called Inner and a method called iMethod.

At line 12, we are within the iMethod method and need to determine which variables may not be referenced correctly.

Let's analyze each option:

A. a - The variable a is a public variable declared in the outer class Outer. It can be accessed from any method within the class Outer, including the nested class Inner. Therefore, variable a can be referenced correctly at line 12.

B. d - The variable d is a local variable declared within the method method. It is not accessible outside the method method. Therefore, variable d may not be referenced correctly at line 12.

C. c - The variable c is a parameter variable of the method method. It is effectively final since it is used within the nested class Inner. Therefore, variable c can be referenced correctly at line 12.

D. b - The variable b is a private variable declared in the outer class Outer. It is not accessible within the nested class Inner, as it is a different class. Therefore, variable b may not be referenced correctly at line 12.

Therefore, the correct answer is B. The variable d may not be referenced correctly at line 12.

- Hide questions