PHP and JSP Web Technologies

Test your knowledge of PHP and JSP/Java web server technologies including operators, arrays, database connections, JSP directives, implicit objects, and JavaBeans.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

JSP expressions should be enclosed within

  1. <% %>
  2. <%= %>
  3. <%! %>
  4. <!-- -->
Question 2 Multiple Choice (Single Answer)

Predefined variables are also called as

  1. scriptlets
  2. declarations
  3. implicit objects
  4. expressions
Question 3 Multiple Choice (Single Answer)

The following is not an implicit object

  1. out
  2. response
  3. session
  4. page
Question 4 Multiple Choice (Single Answer)

Following is a type of JSP directives

  1. page
  2. include
  3. taglib
  4. all the above
Question 5 Multiple Choice (Single Answer)

The number of page directives

  1. 8
  2. 12
  3. 16
  4. 9
Question 6 Multiple Choice (Single Answer)

The only page directive that can be used a number of times in a jsp is

  1. extends
  2. session
  3. import
  4. language
Question 7 Multiple Choice (Single Answer)

The following is not a feature of java beans

  1. directives
  2. properties
  3. methods
  4. events
Question 8 Multiple Choice (Single Answer)

A Bean class

  1. must have empty constructor
  2. should have no public fields
  3. Both a and b
  4. None of a and b
Question 9 Multiple Choice (Single Answer)

The number of JSP action tags

  1. 2
  2. 3
  3. 4
  4. 5
Question 10 Multiple Choice (Single Answer)

TLD is

  1. Tag Library Descriptor
  2. Tag Language Description
  3. Tag Library Description
  4. Tag Language Dynamics
Question 11 Multiple Choice (Single Answer)

package polymorphism;class TestPolymorphismSuper { int p; TestPolymorphismSuper testPoly() { TestPolymorphismSuper TS = new TestPolymorphismSuper(); TS.p =100; return TS; }}public class TestPolymorphism1 extends TestPolymorphismSuper{ TestPolymorphism1 testPoly() { TestPolymorphism1 TSub = new TestPolymorphism1(); TSub.p =500; return TSub; } public static void main(String[] args) { TestPolymorphismSuper TSuper = new TestPolymorphism1(); TSuper = TSuper.testPoly(); System.out.println(TSuper.p); }}

  1. 500
  2. 100
  3. 0
  4. Null Pointer Exception
Question 12 Multiple Choice (Single Answer)

Which PHP function do you use to connect to a mysql database.

  1. mysql_selectDB_server($server,$user,$password)
  2. mysql_connection($server,$user,$password)
  3. mysql_connect($server,$user,$password)
  4. database_connect($mysql,$server,$user,$password,$database)
Question 13 Multiple Choice (Single Answer)

Which is the correct way to call an object method?

  1. $object.method()
  2. $object->$method()
  3. $object:$method()
  4. $object->method()
Question 14 Multiple Choice (Single Answer)

Which is the problem with the following code using PHP5?

  1. Object attributes are not of any specific data type
  2. The constructor of the class is not correctly defined
  3. You cannot put an equal when recieving a parameter in the constructor
  4. The word function is missing before the class constructor
Question 15 Multiple Choice (Single Answer)

Which is the final value of $n?

  1. 36
  2. 30
  3. 33
  4. 25
Question 16 Multiple Choice (Single Answer)

Which is the function, besides join(), that you use to join array elements with a string?

  1. strconcat(string $glue, array $pieces)
  2. implode ( string $glue , array $pieces )
  3. strcmp(array $pieces, string $concat, int $elementNumber)
  4. arrayConcat(array $pieces, string $concat, string $EOF)
Question 17 Multiple Choice (Multiple Answers)

Which logical operators are allowed in PHP?

  1. &&
  2. and
  3. nxor
  4. ||
Question 18 Multiple Choice (Multiple Answers)

Which of these are valid array operators in php?

  1. ==
  2. ===
  3. +
  4. union
Question 19 Multiple Choice (Multiple Answers)

Which of the following are valid bitwise operators in php?

  1. ^
  2. |||
  3. >>
  4. ~
Question 20 Multiple Choice (Single Answer)

If you want to create an associative array in php5, which is the correct manner?

  1. $var = new asoc_array("key"->"value","key2"->"value2");
  2. $var = array("key"=>"value","key2"=>"value2");
  3. $var = new ArrayList("key,value","key1,value1");
  4. $var = new List(Of Associative)["key"=>"value","key1","value1"];