Tag: technology

Questions Related to technology

  1. PreparedStatement

  2. ParameterizedStatement

  3. ParameterizedStatement and CallableStatement

  4. All kinds of Statements (i.e. which implement a sub interface of Statement)


Correct Option: A
  1. public interface B extends A { }

  2. public interface B implements A {}

  3. public interface B instanceOf A {}

  4. public interface B inheritsFrom A { }


Correct Option: A
Explanation:

To solve this question, the user needs to know the basics of Java interfaces and inheritance.

Option A is the correct answer: A programmer can create a child interface by using the "extends" keyword and specifying the parent interface name. In this case, interface B can be created by extending interface A as follows:

public interface B extends A {}

Option B is incorrect because the "implements" keyword is used to implement an interface, not to extend it.

Option C is incorrect because "instanceOf" is a keyword used to test if an object is an instance of a class, not to create an interface that inherits from another interface.

Option D is incorrect because "inheritsFrom" is not a valid keyword in Java to indicate inheritance.

Therefore, the answer is: A. public interface B extends A {}

  1. TestA

  2. TestB

  3. Compilation fails.

  4. An exception is thrown at runtime.


Correct Option: B
Explanation:

To solve this question, the user needs to understand inheritance and polymorphism in Java.

The TestB class extends the TestA class and overrides its start method. The main method creates a new instance of TestB and casts it to a TestA object.

The start method is called on this TestA object, but since the object being referred to is actually an instance of TestB, the overridden start method in TestB is called instead of TestA's original start method.

Since TestB's start method prints "TestB" to the console, the resulting output when the program is run will be:

TestB

Therefore, the answer is: B.

  1. A DataSource is the basic service for managing a set of JDBC drivers

  2. A DataSource is the Java representation of a physical data source

  3. A DataSource is a registry point for JNDI-services

  4. A DataSource is a factory of connections to a physical data source


Correct Option: D
  1. test

  2. null

  3. Compilation fails because of an error in line 1

  4. Compilation fails because of an error in line 5


Correct Option: A
Explanation:

To solve this question, the user needs to understand the concept of anonymous inner classes and the toString() method.

Explanation of the code:

  • An interface TestA is defined in line 1 with a single method toString().
  • In line 4, an anonymous inner class is created that implements the TestA interface and overrides the toString() method to return the string "test".
  • In line 6, the toString() method of the anonymous inner class is called, which returns "test".
  • In line 4, the anonymous inner class is passed as an argument to the println() method of System.out, which prints the value returned by the toString() method to the console.

Options Explanation:

  • Option A: This option is correct because the output of the program is "test", which is returned by the toString() method of the anonymous inner class.
  • Option B: This option is incorrect because the output of the program is not null.
  • Option C: This option is incorrect because there is no error in line 1. The interface TestA is defined correctly.
  • Option D: This option is incorrect because there is no error in line 5. The toString() method is overridden correctly.

The answer is: A. test

  1. It may iterate over arrays, collections, maps and strings.

  2. The body of the tag may contain EL code, but not scripting code.

  3. When looping over collections, a loop status object may be used in the tag body.

  4. It may iterate over a map, but only the key of the mapping may be used in the tag body.

  5. When looping over integers (for example begin1='1' end='10'), a loop status object may not be used in the tag body.


Correct Option: A,C
  1. Devolve

  2. Infector

  3. Delf

  4. Argentino


Correct Option: A
  1. ADM worm

  2. Phoenix I

  3. Phoenix II

  4. Backage


Correct Option: C