Test 3 Java 2023
Test 3 Java 2023
RN SHETTY TRUST®
RNS INSTITUTE OF TECHNOLOGY
Affiliated to VTU, Recognized by GOK, Approved by AICTE, New Delhi
(NAAC ‘A+ Grade’ Accredited, NBA Accredited (UG - CSE, ECE, ISE, EIE and EEE))
Channasandra, Dr. Vishnuvardhan Road, Bengaluru – 560 098
Department of Electronics & Instrumentation Engineering
PART 2
3a What is a thread? 2 L1 3
3b Illustrate a single-threaded program and a multi-threaded program with figures. 4 L2 3
3c Explain the creation of a new thread with example. 4 L2 3
OR
4 Describe the complete life cycle of a thread. 10 L2 3
PART 3
5a Write a Java program illustrating the use of the Thread Methods - yield, stop & sleep. 6 L2 3
5b How are threads synchronized? 4 L2 3
OR
6a Discuss how thread exceptions are handled. 3 L2 3
6b How do we set priorities for threads? 3 L2 3
6c Explain how threads are created by implementing the ‘runnable interface’. 4 L2 3
PART 4
7a Define an applet. How do applets differ from application programs? 3 L2 4
7b What are the steps involved in developing and testing an applet in Java environment? 4 L2 4
7c Sketch the transition diagram of the lifecycle of an applet. 3 L1 4
OR
Describe how an applet displays numerical values and gets input from the user. Use a suitable
8 10 L4 5
Java code.
PART 5
9a Briefly describe three major sections involved in designing a webpage. 4 L2 5
9b Describe the applet tag features / attributes 3 L1 5
9c Explain a few important HTML Tags and their functions 3 L1 5
OR
10a Provide the syntax/general format of the applet code with an example (say HelloJava applet). 4 L2 4
10b Explain the designing of a web page using applets. 6 L2 5
*L – Bloom’s Cognitive Level - BCL: L1 – Remember, L2 –Understand, L3 - Apply, L4 – Analyze, L5 – Evaluate, L6 – Create
CO - Course Outcomes: After studying this course, students will be able to:
CO1: Explain the object-oriented concepts and JAVA. CO2: Develop computer programs to solve real world problems in Java.
CO3: Develop multithreaded applications with synchronization. CO4: Develop applets for web applications.
CO5: Design GUI based applications.
Test 3 Syllabus Mapping of Java Programming – 18EI63 ; VI EI ; Faculty: Dr. Andhe Pallavi
Syllabus (Test Question Number)
Module -4 – Q 1a.b 2a, b
Packages: JAVA API Packages (1a), Using System packages, (1b) Naming conventions, Creating, Accessing
(1b) and Using a package, Adding a class to a Package (2b), Hiding Classes.
Module -4 Q 3 , 4, 5, 6
Multithreaded Programming : (3a, 3b) Creating and Extending Thread Class (3c), Stopping, Blocking and
Life Cycle of Thread (4), Using Thread Methods (5a), Thread Exceptions and Priority (6a, 6b),
Synchronization (5b), Implementing runnable Interface (6c).
Module -5 Questions 7 - 10
Applet Programming: Introduction (7a), How Applets Differ from Applications (7b), Preparing to write
Applets, Building Applet Code (7b), Applet Life Cycle (7c), Creating an Executable Applet (10a), Designing
a Web Page (9a), Applet Tag (9b), Adding Applet to HTML File (10b), Running the Applet, Passing
Parameters to Applets, Aligning the Display, More about HTML Tags (9c), Displaying Numerical Values (8),
Getting Input from the User (8), Event Handling.
‘Test 3 Answer Scheme’ of Java Programming – 18EI63; VI EI ; Faculty: Dr. Andhe Pallavi
5a Write a Java program illustrating the use of the Thread Methods - yield, stop & sleep. 6
5b How are threads synchronized? 4
It is done by using the keyword ‘synchronized’ with the method or block of code. Java creates a ‘monitor’ and hands it over to
the first thread accessing the ‘synchronized’ method. As long as this thread has the key, the other threads cannot access this
method.
6a Discuss how thread exceptions are handled. 3
Using ‘try-catch’ block when the thread is in ‘blocked” state due to sleep, suspend, wait. Else Java run system will throw
‘IllegalThreadStateException’ as the exception can not be handled by the thread.
6b How do we set priorities for threads? 3
Using the setPriority() method. ThreadName. setPriority(intNumber)
intNumber is a constant between 1 & 10. ‘Thread’ class defines the priority constants as:
MIN_PRIORITY = 1 ; MAX_PRIORITY = 10 ; NORM_PRIORITY = 5
6c Explain how threads are created by implementing the ‘runnable interface’. 4
<TITLE> … </TITLE> The text contained in it will appear in the title bar of the browser.
This tag contains the main text of the Web page. It is the place where the <APPLET> tag is
<BODY> … </BODY>
declared.
<H1> … </H1> Header tags. Used to display headings. <H1> creates the largest font header, while <H6>
<H6> … </H6> creates the smallest one.
<CENTER> … </CENTER> Places the text contained in it at the center of the page.
<APPLET …> <APPLET...> tag declares the applet details as its attributes.
<APPLET> … </APPLET> May hold optionally user-defined parameters using <PARAM> Tags.
Supplies user-defined parameters. The <PARAM> tag needs to be placed between the
<PARAM …> <APPLET> and </APPLET> tags. We can use as many different <PARAM> tags as we
wish for each applet.
<B> … <B> Text between these tags will be displayed in bold type.
<BR> Line break tag. This will skip a line. Does not have an end tag.
Para tag. This tag moves us to the next line and starts a paragraph of text. No end tag is
<P>
necessary.
<IMG …> This tag declares attributes of an image to be displayed.
<HR> Draws a horizontal rule.
<A…> </A> Anchor tag used to add hyperlinks.
We can change the color and size of the text that lies in between <FONT> and </FONT>
<FONT…> … </FONT>
tags using COLOR and SIZE attributes in thetag<FONT...>.
Any text starting with a < ! mark and ending with a > mark is ignored by the Web browser.
<! ….>
We may add comments here. A comment tag may be placed anywhere in a Web page.
10a Provide the syntax/general format of the applet code with an example (say HelloJava applet). 4