0% found this document useful (0 votes)
25 views4 pages

WT Makeup MidSem Spring 2023

The document describes a makeup mid-semester examination for the subject Web Technology at Kalinga Institute of Industrial Technology. It contains 5 one-mark multiple choice questions related to Java programming concepts like exceptions, inheritance, and access modifiers. It also asks to write HTML code to create a web page with login and personal details forms. Finally, it asks to write a Java program implementing an interface with concrete classes and explain what would happen if an abstract class is declared as final or contains a static method.

Uploaded by

throwawayzep37
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)
25 views4 pages

WT Makeup MidSem Spring 2023

The document describes a makeup mid-semester examination for the subject Web Technology at Kalinga Institute of Industrial Technology. It contains 5 one-mark multiple choice questions related to Java programming concepts like exceptions, inheritance, and access modifiers. It also asks to write HTML code to create a web page with login and personal details forms. Finally, it asks to write a Java program implementing an interface with concrete classes and explain what would happen if an abstract class is declared as final or contains a static method.

Uploaded by

throwawayzep37
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
You are on page 1/ 4

th

Semester:
Semester: 44th (Regular - Makeup)
Subject Name:-
Sub & Code: OSWT
& CS& Code:-
- 2009 IT 2004
Branch (s): - B.Tech.[CSE/IT/CSCE/CSSE]
Branch (s): CSE, IT, CSSE, CSCE

SPRING MAKEUP MID SEMESTER EXAMINATION-2023


School of Computer Engineering
Kalinga Institute of Industrial Technology, Deemed to be University
Subject Name: Web Technology
[Subject Code: IT 2004]
Time: 1 1/2 Hours Full Mark: 20

All Questions are compulsory.


The figures in the margin indicate full marks. Candidates are required to give their answers in their own
words as far as practicable and all parts of a question should be answered at one place only.

1. Answer all the questions. [1x5]


a) Pick the correct alternative as the output of the following code snippet with proper justification.
import java.io.*;
public class TestException {
public static void main(String[] args) {
try { go(1 = = 0);
go(1 = = 1);
} catch (FileNotFoundException e) { System.out.println(e); }
catch (IOException e) { System.out.println(e); }
catch (Exception e) { System.out.println(e); }
}
public static void go (boolean b) throws IOException, FileNotFoundException {
if (!b) throw new IOException();
throw new FileNotFoundException();
}
}
i. Compilation Time Error ii. Execution Time Error
iii. Display: “java.io.IOException” iv. Display: “java.io.FileNotFoundException”

Answer: (iii) Display: “java.io.IOException”


Evaluation Scheme: Award 1 for correct option, 0 for wrong option.

b) Pick the correct alternative as the output of the following code snippet with proper justification.
class Outer {
int x = 10;
class Inner {
int x = 100;
void show(int x){ System.out.println(x); }
}
class InnerSub extends Inner {
int x = 1000;
void show(int x){ super.show(this.x); }
}
public static void main(String[] args) {
int x = 10000;
new Outer().new InnerSub().show(x);
}
th
Semester:
Semester: 44th (Regular - Makeup)
Subject Name:-
Sub & Code: OSWT
& CS& Code:-
- 2009 IT 2004
Branch (s): - B.Tech.[CSE/IT/CSCE/CSSE]
Branch (s): CSE, IT, CSSE, CSCE
}
i. 10 ii. 100 iii. 1000 iv. 10000

Answer: (iii) 1000


Evaluation Scheme: Award 1 for correct option, 0 for wrong option.

c) Which one(s) of the following statements is/are not True?


i. A final method can be overridden in the subclass.
ii. A final class can be instantiated at runtime.
iii. Final keyword is one of the access modifiers in Java.
iv. A final variable is treated as constant.
Answer: (i) and (iii)
Evaluation Scheme: Award 1 for correct for selecting both the correct alternatives, award 0.5 for selecting at
least one correct alternative, 0 for selecting wrong alternatives.

d) What is the difference between <link> tag and <a> tag in HTML? Explain with suitable examples.

Answer: The anchor tag <a> is used to create a hyperlink to another webpage or to a certain part of the
webpage and these links are clickable, whereas, link tag <link> defines a link between a document and an
external resource and these are not clickable.

Example: <link> tag


<!DOCTYPE html>
<html>
<head> <title>Link Tag</title>
<link rel="stylesheet" href="./externalResource.css" />
</head>
<body>
<h2 id="hello"> Hello, World! </h2>
</body>
</html>

Example: <a> tag


<!DOCTYPE html>
<html>
<body>
<h2>Anchor Tags</h2>
<a href="https://www.google.com" target="_blank"> Google Home Page </a><br>
</body>
</html>

Evaluation Scheme: Award 1 for correct answer with suitable example and 0 for wrong answer. 0.5 mark may
be awarded for partially correct answer or answer without example.

e) Which one(s) of the following statements is/are True?


i. An abstract class can have full definitions of all its methods.
ii. If a derived class does not override the methods of an abstract super class then it itself
becomes an abstract class.
iii. A class may be derived from any number of classes in Java.
iv. A top class (outer class) can be declared as public, private, and protected.
th
Semester:
Semester: 44th (Regular - Makeup)
Subject Name:-
Sub & Code: OSWT
& CS& Code:-
- 2009 IT 2004
Branch (s): - B.Tech.[CSE/IT/CSCE/CSSE]
Branch (s): CSE, IT, CSSE, CSCE
Answer: (i) and (ii)
Evaluation Scheme: Award 1 for correct for selecting both the correct alternatives, award 0.5 for selecting at
least one correct alternative, 0 for selecting wrong alternatives.

2. Write an HTML code to create a web page as per the following style and specifications. On
clicking the Login Page link, a login page containing User Id and Password should be displayed on the
form display area. On clicking the Personal Details link, a form containing Name (Textbox), Roll No
(Textbox), Gender (Radio Button), Hobbies (Checkbox) and Nationality (Drop-down List) followed by
Submit and Reset Buttons below the page should be displayed on the same area. [ 5 Marks ]

Evaluation Scheme: Award full marks (5) for correct and complete webpage as per all the specifications in the
question. Partial credit may be awarded for partially correct/incompletely designed webpage.

3. (a) Write a program in Java having an interface called Address with two methods called
getAddress() and setAddress(). The Address interface is implemented by three concrete classes named
HomeAddress, OfficeAddress and SchoolAddress. Use dynamic method dispatch concept to override the
above mentioned methods and display the address of home, office and school accordingly.
(b) What will happen if we define a Java abstract class as final? What will happen if we define a
static method inside a Java abstract class? Justify your answers in both the cases. [ 3 + 2 = 5 Marks ]
Evaluation Scheme 3(a): Award full marks (3) for correct and complete Java code as per all the specifications in
the question. Partial credit may be awarded for partially correct/incompletely designed program.

Answer 3(b) Part 1: If you declare a class abstract, to use it, you must extend it. On the other hand, if you
declare a class final, you cannot extend it. Since these two declarations contradict with each other you cannot
declare a class both abstract and final. If you do so a compile time error will be generated.

Evaluation Scheme: Award full marks (1) for correct answer in this part.

Answer 3(b) Part 2: If you declare a method in an abstract class, to use it, you must override this method in the
subclass. But, overriding is not possible with static methods. Therefore, an abstract method cannot be static. If
you do so a compile time error will be generated.

Evaluation Scheme: Award full marks (1) for correct answer in this part.

4. (a) Implement a class CPU having private data members manufacturer (String) and price
(double), and two inner classes Processor and RAM. Processor class has private data members
numcores (int) and manufacturer (String), and private methods getCache() and setCache(). RAM class
has private data members memory (double) and manufacturer (String), and private methods
getClockSpeed() and setClockSpeed(). Finally, implement a driver class Main to create a CPU object
and display all the details of that object in user console.
(b) What is Anonymous Inner class in Java? Explain with suitable example. [ 3 + 2 = 5 Marks]
th
Semester:
Semester: 44th (Regular - Makeup)
Subject Name:-
Sub & Code: OSWT
& CS& Code:-
- 2009 IT 2004
Branch (s): - B.Tech.[CSE/IT/CSCE/CSSE]
Branch (s): CSE, IT, CSSE, CSCE
Evaluation Scheme 4(a): Award full marks (3) for correct and complete Java code as per all the specifications in
the question. Partial credit may be awarded for partially correct/incompletely designed program.

Evaluation Scheme 4(a): Award full marks (2) with correct answer with proper example. Partial credit may be
awarded for incomplete/partially correct answers or answers with no example.
*** Best of Luck ***

You might also like