Jpr - Qb Chapter 05

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Jpr - Qb Chapter 05 as PDF for free.

More details

  • Words: 810
  • Pages: 4
K K Wagh Polytechnic, Nashik – 3

Question Bank

: Java Programming (9113)

Class

: TYIF (IF/V/C)

Chapter No. 05

Applets and Graphics Programming

Review Questions from previous MSBTE question papers: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

Explain the life cycle of Applet in detail. Give the hierarchy of Applet class. Describe the methods used in applet skeleton. Give differences between start( ) and init( ) methods of Applet class. Differentiate between application and an applet. Explain the syntax of standard HTML applet tag. State the differences between stop( ) and destroy( ) methods. Why it is necessary to declare the subclass of an Applet class as public? Explain the operations of paint( ) method. Why it is necessary? Why Java applet does not contain a main( ) method? How to pass parameters to the applet? Illustrate with example. Describe the methods getCodeBase( ) and getDocumentBase( ) with suitable example. Which are methods related to a Font and Color class? Explain. How to build applet into HTML file? How to connect two applet files to each other? Explain. Illustrate the use of update( ) and repaint( ) with example. Enlist applications of Applet. Explain various methods of Graphics to draw different shapes on the applet. How to draw a circle using drawOval( ) and drawArc( ) methods? Give and explain different syntax of creating polygons on applet.

Programming Exercises: 1. 2. 3. 4. 5. 6.

Create an applet with size 300 X 200 and display “Hello” on it at the center. Display the numbers from 1 to 10 reversely on the applet. Display a pentagon on the applet filled with green color. Create an applet to display the string “Applet Graphics Programming” with font “Courier New”, size: 15 points and BOLD + ITALIC. Display different concentric oval shapes on the applet at the center with different colors. Create an applet with blue background, yellow foreground and display string “Core Java Programming” with Arial font point size = 20.

By Mr. Kute T. B. for (TYIF) 2008-2009

-1-

K K Wagh Polytechnic, Nashik – 3

7. 8.

9. 10.

Accept a date using <param> tag and display along with the message, “My Birthday is: “. Accept the flower name as parameter and display it along with the message “It is a beautiful flower”. The HTML file should be placed in the directory called flower. The background color of this applet is light gray. The text displayed in Times new roman with 40 points. Input two strings from <param> tag concatenate them and display them in the status window. Create an applet with background color red and draw a circle at the middle of applet which if filled with blue color.

Objective questions: 1.

In order to cause the paint(Graphics) method to execute, which of the following is the most appropriate method to call: a) paint() b) repaint() c) paint(Graphics) d) update(Graphics) e) None – you should never cause paint(Graphics) to execute

2.

Consider the following tags and attributes of tags: 1 CODEBASE 2 ALT 3 NAME 4 CLASS 5 JAVAC 6 HORIZONTALSPACE 7 VERTICALSPACE 8 WIDTH 9 PARAM 10 JAR Which of the above can be used within the <APPLET> and tags? a) line 1, 2, 3 b) line 2, 5, 6, 7 c) line 3, 4, 5 d) line 8, 9, 10 e) line 8, 9

3.

Which of the following illustrates the correct way to pass a parameter into an applet: a) b) <param name=age value=33> c)

By Mr. Kute T. B. for (TYIF) 2008-2009

-2-

K K Wagh Polytechnic, Nashik – 3

d) 4.

If the following HTML code is used to display the applet in the code MgAp what will be displayed at the console? public class my extends Applet{ public void init(){ System.out.println(getParameter("age")); } }

5.

In which package the Graphics class is defined? a) java.io b) java.lang c) java.applet d) java.awt

6.

showDocument( ) is the method of … a) Applet b) Graphics c) AppletContext d) DocumentBase

7.

Which is the last method called when the applet execution is completed? a) paint() b) sleep() c) stop() d) destroy()

8.

The Applet is subclass of which class from AWT package? a) Panel b) Container c) Component d) Frame e) Window f) JApplet

9.

Which method is used to change the contents of status window? a) statusWindow() b) showStatus() c) showDocument() d) showWindow()

By Mr. Kute T. B. for (TYIF) 2008-2009

-3-

K K Wagh Polytechnic, Nashik – 3

10.

Which of the following color is not available in Java library? a) Color.vermilion b) Color.cyan c) Color.magenta d) Color.lightGray

By Mr. Kute T. B. for (TYIF) 2008-2009

-4-

Related Documents

Jpr - Qb Chapter 05
June 2020 3
Jpr - Qb Chapter 02
June 2020 11
Jpr - Qb Chapter 06
June 2020 5
Jpr - Qb Chapter 01
June 2020 7
Jpr - Qb Chapter 04
June 2020 7
Jpr - Qb Chapter 03
June 2020 10