WT Makeup MidSem Spring 2023
WT Makeup MidSem Spring 2023
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
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
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.
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.
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 ***