0

web technology Online Quiz - 116

Description: web technology Online Quiz - 116
Number of Questions: 20
Created by:
Tags: web technology
Attempted 0/20 Correct 0 Score 0

What are the life cycle methods in jsp?

  1. jspInit()

  2. jspservice()

  3. jspDestroy()

  4. All of the above


Correct Option: D

How many types of text formats in jsp?

  1. Static Content

  2. Dynamic content

  3. Both a and b

  4. None of the above


Correct Option: C

How to clear the JVM logs in server?

  1. By sending a mail to websphere_test team

  2. By submitting a work request to WDT team

  3. Either a or b

  4. None of the above


Correct Option: B

Log which helps to see the errors raised only during the particular date and time

  1. EML viewer

  2. Logs in wasops

  3. Both a and b

  4. None of the above


Correct Option: A

In MVC Architecture, the significance of Model is ______.

  1. Business Logic

  2. UI

  3. Control Logic

  4. None of the above


Correct Option: A

MVC architecture is used commonly because

  1. The addition, editing, and removal of interfaces is simple

  2. Changes made to the logic control are easy

  3. Helps developers avoid repeating common code

  4. All of the above


Correct Option: D

Struts is based on MVC framework

  1. True

  2. False


Correct Option: B

The logs for the server can be viewed through

  1. EML viewer

  2. Logs in wasops

  3. Both a and b

  4. None of the above


Correct Option: C

What is the output of the following StringBuffer sb1 = new StringBuffer("Amit"); StringBuffer sb2= new StringBuffer("Amit"); String ss1 = "Amit"; System.out.println(sb1==sb2); System.out.println(sb1.equals(sb2)); System.out.println(sb1.equals(ss1)); System.out.println("Poddar".substring(3));

  1. false false false dar

  2. false true false Poddar

  3. Compiler Error

  4. true true false dar


Correct Option: A

AI Explanation

To answer this question, let's go through each option one by one:

Option A) false false false dar - This option is incorrect. The output of the given code is not "false false false dar".

Option B) false true false Poddar - This option is incorrect. The output of the given code is not "false true false Poddar".

Option C) Compiler Error - This option is incorrect. There is no compiler error in the given code.

Option D) true true false dar - This option is incorrect. The output of the given code is not "true true false dar".

Now, let's analyze the code step by step:

StringBuffer sb1 = new StringBuffer("Amit");
StringBuffer sb2 = new StringBuffer("Amit");
String ss1 = "Amit";
System.out.println(sb1 == sb2);
System.out.println(sb1.equals(sb2));
System.out.println(sb1.equals(ss1));
System.out.println("Poddar".substring(3));

In the given code, sb1 and sb2 are StringBuffer objects with the value "Amit", and ss1 is a String object with the value "Amit".

  1. System.out.println(sb1 == sb2); - This statement compares the references of sb1 and sb2. Since they are two separate StringBuffer objects, the result is false.

  2. System.out.println(sb1.equals(sb2)); - This statement compares the contents of sb1 and sb2. The equals() method in the StringBuffer class is not overridden to compare the contents, so it compares the references. Since sb1 and sb2 are two separate objects, the result is false.

  3. System.out.println(sb1.equals(ss1)); - This statement compares the contents of sb1 and ss1. The equals() method in the StringBuffer class is not overridden to compare the contents, so it compares the references. Since sb1 is a StringBuffer object and ss1 is a String object, the result is false.

  4. System.out.println("Poddar".substring(3)); - This statement returns a substring of the string "Poddar" starting from index 3. The substring is "dar".

Therefore, the correct answer is option A) false false false dar.

When a string literal is used in the program, Java automatically creates instances of the string class.

  1. True

  2. False


Correct Option: B

Which of the following are primitive types?

  1. byte

  2. String

  3. integer

  4. Float


Correct Option: A

AI Explanation

To answer this question, you need to understand the concept of primitive types in programming.

Primitive types are basic data types that are built into a programming language and are not composed of other types. They are typically used to represent simple values.

Let's go through each option to understand why it is correct or incorrect:

Option A) byte - This option is correct because byte is a primitive type in many programming languages, including Java. It represents an 8-bit signed integer.

Option B) String - This option is incorrect because String is not a primitive type. It is a class in Java and other programming languages, used to represent a sequence of characters.

Option C) integer - This option is incorrect because "integer" is not a specific primitive type. However, if it refers to the "int" type, then it is correct. "int" is a primitive type in Java, representing a 32-bit signed integer.

Option D) Float - This option is incorrect because "Float" is not a primitive type. It is a class in Java and other programming languages, used to represent a single-precision floating-point number. The primitive type for floating-point numbers is "float".

The correct answer is Option A) byte. This option is correct because byte is a primitive type.

What is the output (Assuming written inside main) String s1 = new String("amit"); String s2 = s1.replace('m','i'); s1.concat("Poddar"); System.out.println(s1); System.out.println((s1+s2).charAt(5));

  1. Compile error

  2. amitPoddar O

  3. amitPoddar I

  4. amit I


Correct Option: D

What is the output of following (Assuming written inside main) String s1 = "Amit"; String s2 = "Amit"; String s3 = new String("abcd"); String s4 = new String("abcd"); System.out.println(s1.equals(s2)); System.out.println((s1==s2)); System.out.println(s3.equals(s4)); System.out.println((s3==s4));

  1. True true true false

  2. True true true true

  3. True false true false

  4. False false true false


Correct Option: A

AI Explanation

To answer this question, let's go through each line of code:

  1. String s1 = "Amit"; - This line creates a string variable s1 and assigns it the value "Amit".
  2. String s2 = "Amit"; - This line creates another string variable s2 and assigns it the value "Amit". Since string literals are interned in Java, both s1 and s2 refer to the same object in memory.
  3. String s3 = new String("abcd"); - This line creates a new string object s3 using the new keyword. This will create a new object in memory with the value "abcd".
  4. String s4 = new String("abcd"); - This line creates another new string object s4 using the new keyword. This will also create a new object in memory with the value "abcd".
  5. System.out.println(s1.equals(s2)); - This line compares the values of s1 and s2 using the equals() method. Since both s1 and s2 have the same value ("Amit"), the equals() method will return true.
  6. System.out.println((s1==s2)); - This line compares the references of s1 and s2 using the == operator. Since both s1 and s2 refer to the same object in memory, the == operator will return true.
  7. System.out.println(s3.equals(s4)); - This line compares the values of s3 and s4 using the equals() method. Since both s3 and s4 have the same value ("abcd"), the equals() method will return true.
  8. System.out.println((s3==s4)); - This line compares the references of s3 and s4 using the == operator. Since s3 and s4 are separate objects created using the new keyword, they refer to different objects in memory. Therefore, the == operator will return false.

Based on the above explanations, the correct answer is A) True true true false.

How to clear the JVM logs in server?

  1. By sending a mail to websphere_test team

  2. By submitting a work request to WDT team

  3. Either a or b

  4. None of the above


Correct Option: B

Log which helps to see the errors raised only during the particular date and time

  1. EML viewer

  2. Logs in wasops

  3. Both a and b

  4. None of the above


Correct Option: A

In MVC Architecture, the significance of Model is ______.

  1. Business Logic

  2. UI

  3. Control Logic

  4. None of the above


Correct Option: A

MVC architecture is used commonly because

  1. The addition, editing, and removal of interfaces is simple

  2. Changes made to the logic control are easy

  3. Helps developers avoid repeating common code

  4. All of the above


Correct Option: D

The logs for the server can be viewed through

  1. EML viewer

  2. Logs in wasops

  3. Both a and b

  4. None of the above


Correct Option: C

What is the output of the following StringBuffer sb1 = new StringBuffer("Amit"); StringBuffer sb2= new StringBuffer("Amit"); String ss1 = "Amit"; System.out.println(sb1==sb2); System.out.println(sb1.equals(sb2)); System.out.println(sb1.equals(ss1)); System.out.println("Poddar".substring(3));

  1. false false false dar

  2. false true false Poddar

  3. Compiler Error

  4. true true false dar


Correct Option: A
- Hide questions