1.
Which of the following XML documents are well-formed?
Correct Answer
B. <firstElement>some text goes here</firstElement>
<secondElement> another text goes here</secondElement>
Explanation
The given XML document is well-formed because it follows the rules of XML syntax. It has a root element, , which is properly closed with . It also has a nested element, , which is also properly closed with . The text content is placed within the elements, and there are no syntax errors or inconsistencies in the document.
2.
Attribute standalone="no" should be included in XML declaration if a document:
Correct Answer
D. Has an external DTD
Explanation
The attribute standalone="no" should be included in the XML declaration if the document has an external DTD. This attribute is used to indicate whether the document relies on an external DTD or not. By including standalone="no", it signifies that the document is not self-contained and requires the presence of the external DTD for proper validation and interpretation.
3.
To use the external DTD we have the syntax:
Correct Answer
A. <?xml version=”A.0” standalone=”no”?>
<! DOCTYPE DOCUMENT SYSTEM “order.dtd”?>
Explanation
The correct answer is "". This is the correct syntax for using an external DTD in an XML document. The "DOCTYPE" declaration specifies the type of document and the location of the DTD file. In this case, the DTD file is named "order.dtd" and it is located in the same directory as the XML document. The "SYSTEM" keyword is used to indicate that the DTD file is an external file. The "standalone" attribute is set to "no" to indicate that the document depends on the external DTD for its structure and validation.
4.
Which option is true about session scope?
Correct Answer
B. Objects are accessible only from the pages which are in same session
Explanation
Session scope refers to the lifespan of an object in a web application. When an object is stored in session scope, it is accessible only from the pages that are in the same session. This means that the object can be accessed and manipulated by any page within the same session, but not by pages in different sessions. This allows for the sharing of data and information between multiple pages within a single session, providing a way to maintain state and pass data between different parts of an application.
5.
Consider the following statement containing regular expressions
var text = "testing: 1, 2, 3";
var pattern = /\d+/g;
In order to check if the pattern matches, the statement is
Correct Answer
D. Pattern.test(text)
Explanation
The correct answer is "pattern.test(text)" because the test() method is used to check if a pattern matches a string. In this case, the pattern is /\d+/g which matches one or more digits, and the string is "testing: 1, 2, 3". So, by using the test() method on the pattern with the string as the argument, we can determine if the pattern matches the string.
6.
Which one of the following function is used to start a session?
Correct Answer
B. Session_start()
Explanation
The correct answer is session_start(). This function is used to start a session in PHP. It initializes the session data and assigns a unique session ID to the user. Once the session is started, you can store and retrieve data in the session variables throughout the user's browsing session.
7.
What is the constraint on the data per cookie?
Correct Answer
C. 4 KB
Explanation
The constraint on the data per cookie is 4 KB. This means that the maximum amount of data that can be stored in a single cookie is 4 kilobytes.
8.
“request” is instance of which one of the following classes?
Correct Answer
C. HttpServletRequest
Explanation
The correct answer is HttpServletRequest. The reason is that HttpServletRequest is a class in Java that represents an HTTP request made by a client to a server. It provides methods to access information such as parameters, headers, and cookies of the request. Therefore, "request" is an instance of the HttpServletRequest class.
9.
Match the following.
- [^...] p. Matches the non-word characters.
- [...] q. Matches the non-digits.
- \W r. Matches any single character not in brackets.
- \D s. Matches any single character in brackets.
Correct Answer
B. 1-r 2-s 3-p 4-q
Explanation
The correct matching is 1-r, 2-s, 3-p, 4-q. The pattern [^...] matches any single character not in the brackets, so it matches the non-word characters. The pattern [...] matches any single character in the brackets, so it matches the non-digits. The pattern \W matches any single character that is not a word character, so it matches the non-word characters. The pattern \D matches any single character that is not a digit, so it matches the non-digits.
10.
Which are the main features of XML?
Correct Answer
D. All mentioned above
Explanation
The main features of XML include text data description, a human- and computer-friendly format, and the ability to handle data in a tree structure with one-and only one-root element. All of these features are mentioned above, making the answer "All mentioned above" correct.