0% found this document useful (0 votes)
5 views3 pages

B.Sc. Computer Science Internet Technologies Exam

This document outlines the exam details for a B.Sc. (H) Computer Science course on Internet Technologies, including instructions for candidates and six questions covering Java application connectivity, JSP, JavaScript validations, HTTP requests, and JavaScript code analysis. Students are required to attempt any four questions, each carrying equal marks, with a maximum duration of three hours and a total of 75 marks. The questions involve practical programming tasks and theoretical explanations related to web technologies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

B.Sc. Computer Science Internet Technologies Exam

This document outlines the exam details for a B.Sc. (H) Computer Science course on Internet Technologies, including instructions for candidates and six questions covering Java application connectivity, JSP, JavaScript validations, HTTP requests, and JavaScript code analysis. Students are required to attempt any four questions, each carrying equal marks, with a maximum duration of three hours and a total of 75 marks. The questions involve practical programming tasks and theoretical explanations related to web technologies.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unique Paper Code: 32341501

Name of the Course: [Link]. (H) Computer Science

Name of the Paper: Internet Technologies

Semester: V

Duration: 3 Hours

Maximum Marks: 75

Students admitted in the year: 2018

Instructions for Candidates:

Attempt any Four out of Six questions.

All questions carry equal marks.

Q1. A company has to connect a Java application to a database. What is the first step to
establish the connectivity between the application and the database and what are the
different options available for this? What are the other essential parameters required to
successfully establish this connectivity?
Write a program to establish connectivity between a Java application and a database on MS
SQL which should display the details of employees (i.e., emp_id, emp_name, department,
emp_sal) whose department is “Computer Science”. Further, update salary details of all
these selected employees by increasing their salary by 10% of their current salary.

Q2. What is the importance of using a Java based reusable component in server-side scripting
and what are the ways in which it can be used in JSP code?
Write a bean class named Temperature to manipulate the following properties:
currentTemperature, NumOfLocations (It is a read-only property that records the
number of locations sensing the temperature). Display these properties using standard
JSTL action elements.
Q3. What are the different types of validations using JavaScript that can be performed when
sending data accepted from the user through a form on the Internet?
Design a form to enroll students with the following validations:
• Student Roll number (should be numeric and its length should be 4)*
• Name (Only alphabets) *
• Valid email id*
• Country (Drop down list; values should only be India, Australia and Canada)
• Password (length between 8 to 12)*
The form should have a SUBMIT button that on clicking displays the data entered by the
user and a RESET button to clear the data. The star-marked fields are necessary fields.
Design this form using JavaScript and HTML.

Q4. As the JSP specification is based on the Java servlet specification, enumerate reasons (for
and against) favoring JSP over Servlet.

Given the following request:

GET /[Link] HTTP/1.1


User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: [Link]
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

Explain the above request and all the headers used.

Further, also consider the following request:

POST /cgi-bin/[Link] HTTP/1.1


User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: [Link]
Content-Type: text/xml; charset=utf-8
Content-Length: 88
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
course=Computer+Science&subject=CN

Explain the above request and all the headers used.


Q5. Write JSP code to insert the contents to a table Employee with schema given as (username,
firstname, lastname) of mysql database.
Implement a static login page with username “user” and password “root” using JSTL. Also,
perform the necessary validations of the above fields (username and password), such that the
fields should not be left blank and respective messages be shown when correct values are entered
and also when incorrect values are entered by the user.

Q6. Give the output of the following JavaScript code explaining the reason of the output,
wherever the output is produced.

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var x = 10;
[Link]("demo").innerHTML = (x = = = "10");
var a = 10;
var b = 0;
[Link](a/b);
var a = 'internet';
var b = 'technology';
var c = a/b;
[Link](c);
var grand_total = eval (“10*10+5”);
[Link](grand_total);
var firstNames = ["c", "c++", "java", "python", "perl"];
for (var i = 0; i < [Link]; i++) {
if(i%2===0)
continue;
[Link](i);
}
var arr = [1, 2, 3, 4, 5, 6];
[Link](arr);
print([Link]('|'));
[Link](arr);
var new_arr = [Link]();
[Link]("<br>");
[Link](new_arr);
</script>
</body>
</html>

Common questions

Powered by AI

Failure to validate login forms on both client and server sides can result in security breaches such as SQL injection, unauthorized access, and data leakage. Client-side validation offers immediate user feedback but is easily bypassed, necessitating server-side validation for effective enforcement. Proper validation prevents malicious input and protects sensitive data .

GET requests append data to the URL and are cached, bookmarked, and remain in the browser history; they are less secure than POST as they expose data in the URL. POST requests send data in the body of the request, are more secure for sensitive data, are not cached, and do not remain in the browser history. These differences affect applications in terms of security, data confidentiality, and operational efficiency .

Using eval() can lead to security vulnerabilities as it can execute arbitrary code, making it susceptible to injection attacks. Additionally, it can degrade performance since code evaluation is computationally intensive. These pitfalls can be minimized by avoiding eval() and using safer alternatives like JSON.parse() for parsing, and employing strict input validation and sanitization .

JavaBeans provide a reusable component model that helps in encapsulating data and business logic, making server-side scripting more modular and maintainable. This can be implemented in JSP by declaring a bean using the <jsp:useBean> action, and setting or accessing its properties using <jsp:setProperty> and <jsp:getProperty> actions, respectively. Beans make JSP pages easier to manage by separating business logic from presentation .

JavaScript can perform several types of validations: 1) Numeric validation ensures fields like roll numbers contain only numbers of specified length. 2) Text validation ensures fields like names contain only alphabets. 3) Pattern validation checks format constraints, such as valid email patterns. These validations improve user input accuracy without server-side rechecks .

JSP allows separation of presentation and logic, uses tags that are simpler than writing Java code, and facilitates easy integration with HTML. However, servlets may still be preferred in applications that require extensive logic processing without much focus on presentation, due to their better performance in such scenarios .

The first step in connecting a Java application to a database is loading the database driver. This can be done using the Class.forName() method with the specific driver class name as an argument for databases like MS SQL. Options for establishing the connection include JDBC (Java Database Connectivity), ODBC (Open Database Connectivity), and using data sources that are defined in a Java environment .

Challenges include unexpected behaviors in operations that assume homogenous data types, such as arithmetic operations where strings may cause NaN returns. This can be handled through type-checking and conversion functions, ensuring elements undergo expected transformations before processing .

The continue statement skips the current iteration of a loop and proceeds to the next iteration. In the provided code, it skips index positions 0, 2, and 4, resulting in output for indexes 1 and 3 (the odd indices). A real-world application could be filtering events in a scheduler program where only specific event types proceed through subsequent logic .

The expression 'var x = = = "10"' results in false because the triple equals operator (===) in JavaScript checks for both value and type equality, and does not perform type coercion. Here, x is a number and "10" is a string, so the comparison is false despite their values being numerically equal .

You might also like