0% found this document useful (0 votes)
18 views1 page

Prog MCQ1

Uploaded by

harsh bhandarkar
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)
18 views1 page

Prog MCQ1

Uploaded by

harsh bhandarkar
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/ 1

PROGRAMS

Q1: Observe the following code and find which statement contains error.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.event.*;
public class ttp extends JApplet implements ActionListener {
JButton jb = new JButton("click me");
JTextField text = new JTextField(20);
public void init() {
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
jb.setToolTipText("this is button control");
add(jb);
add(text);
text.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
text.setText("hello tyco");
}
}
----------------------------------------------------------------------------------------------------------------------

Q2: Choose missing statements in following code from given options.


import java.awt.*;
import java.applet.*;
/* <applet code="Ellipses" width=300 height=200> </applet> */
public class Ellipses extends Applet {
{
g.drawOval(10, 10, 50, 50);
g.fillOval(100, 10, 75, 50);
g.drawOval(190, 10, 90, 30);
g.fillOval(70, 90, 140, 100);
}
}
----------------------------------------------------------------------------------------------------------------------

Q3: Consider following program and find the missing statement in the code
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
/*<applet code=exp1.class width=200 height=200> </applet> */
public class exp1 extends Applet {

You might also like