JNTU
JNTU MCA 2022 WEB TECHNOLOGIES Previous Question Paper (March/April - 2022 - R20)
Answer any five questions. All questions carry equal marks.
Main
Explain the different control structures used in PHP.
Answer
PHP provides various control structures to manage the flow of execution in a script, categorized into conditional statements and loops:
- Conditional Statements: These allow code to execute based on specific conditions. The if statement executes code if a condition is true; if-else provides an alternative path; elseif handles multiple conditions; and switch selects one of many blocks of code to execute based on a variable's value.
- Looping Structures: These repeat blocks of code. The while loop repeats as long as a condition is true. The do-while loop ensures the code block executes at least once before checking the condition. The for loop is used when the number of iterations is known. The foreach loop is specifically designed for iterating over arrays and objects.
- Control Flow Modifiers: The break statement terminates a loop or switch, while continue skips the remainder of the current loop iteration and proceeds to the next one.
Write a PHP script for searching a website URL for a keyword or sentence.
Answer
To search for a keyword within the content of a URL, you can use file_get_contents() to fetch the page source and strpos() to check for the existence of the keyword.
<?php
$url = "https://www.example.com";
$keyword = "search_term";
$content = @file_get_contents($url);
if ($content !== false) {
if (strpos($content, $keyword) !== false) {
echo "Keyword found on the page.";
} else {
echo "Keyword not found.";
}
} else {
echo "Failed to retrieve URL content.";
}
?>Explain database connectivity in PHP with reference to MYSQL.
Answer
Sign in to view the complete answer paper.
Write a PHP code to open and read content of the file.
Answer
Sign in to view the complete answer paper.
Create an XML schema for employee details.
Answer
Sign in to view the complete answer paper.
How to embed an image in the web page. Discuss any five attributes used in img tag.
Answer
Sign in to view the complete answer paper.
Create a Quiz form using HTML tags. The sample output is as follows HTML stands for
- HighText Machine Language
- HyperText and links Markup Language
- HyperText Markup Language
- None of these
Answer
Sign in to view the complete answer paper.
What is XML Schema? State its purpose and list its advantages over DTD.
Answer
Sign in to view the complete answer paper.
Describe the servlet architecture and the interfaces invoked by the servlet container.
Answer
Sign in to view the complete answer paper.
Demonstrate the use of cookies in servlets with an example.
Answer
Sign in to view the complete answer paper.
Write a servlet program to retrieve data from the database.
Answer
Sign in to view the complete answer paper.
Develop a servlet that handles an HTTP GET request.
Answer
Sign in to view the complete answer paper.
Explain in detail of how to use Java Beans in JSP pages with suitable example.
Answer
Sign in to view the complete answer paper.
How is Client side Java Script different from Server side Java Script?
Answer
Sign in to view the complete answer paper.
Write a Java Script for sorting the elements of an array using functions?
Answer
Sign in to view the complete answer paper.