对应课程:点击查看
起止时间:2021-06-16到2021-07-18
更新状态:每5天更新一次
复习测试
1、 What is best to describe the relationship between Component and Font?
A:Association
B:Aggregation
C:Composition
D:Inheritance
E:244
答案: Association
2、 下面三个表达式中,正确的是 _____.
- frame.setLocationRelativeTo(null);
- frame.setSize(100, 200);
- frame.setVisible(true);
A:1 2 3
B:1 3 2
C:2 1 3
D:3 2 1
E:245
答案: 2 1 3
3、 How many frames are displayed?
import javax.swing.*;
public class Test extends JFrame {
public static void main(String[] args) {
JFrame f1 = new Test();
JFrame f2 = new Test();
JFrame f3 = new Test();
f1.setVisible(true);
f2.setVisible(true);
f3.setVisible(true);
}
}
A:1
B:2
C:3
D:0
E:246
答案: 3
4、 Jpanel的缺省布局方式是______.
A:FlowLayout
B:GridLayout
C:BorderLayout
D:None
E:247
答案: FlowLayout
5、 方法____将给Jpanel p增加一个组件 c。
A:p.add(c)
B:p.getContentPane(c)
C:p.insert(c)
D:p.append(c)
E:248
答案: p.add(c)
6、 Analyze the following code:
import javax.swing.*;
public class Test extends JFrame {
private JButton jbtOK = new JButton(“OK”);
public static void main(String[] args) {
// Create a frame and set its properties
JFrame frame = new Test();
frame.setTitle(“Logic Error”);
frame.setSize(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public Test() {
jbtOK.setToolTipText(“This is a button”);
add(new JButton(“OK”));
}
}
A:The tool tip text is displayed when you move the mouse on the button.
B:The tool tip text will be displayed if you replace add(new JButton(“OK”)) with add(jbtOK).
C:The tool tip text will be displayed if you swap the two lines in the Test constructor.
D:The tool tip text will be displayed if you replace add(new JButton(“OK”)) with add(jbtOK = new JButton(“OK”)).
E:249
答案: The tool tip text will be displayed if you replace add(new JButton(“OK”)) with add(jbtOK).
7、 Show the output of the following code?
import javax.swing.*;
public class Test {
public static void main(String[] args) {
JButton jbtOK = new JButton(“OK”);
System.out.print(jbtOK.isVisible() + “, “);
JFrame frame = new JFrame();
System.out.println(frame.isVisible());
}
}
A:true, true
B:true, false
C:false, true
D:false, false
E:250
答案: true, false
8、 方法___设置按钮jbt上的文字放在图标的右边。
A:jbt.setVerticalTextPosition(JButton.LEFT)
B:jbt.setHorizontalTextPosition(JButton.LEFT)
C:jbt.setHorizontalTextPosition(JButton.RIGHT)
D:jbt.setHorizontalAlignment(JButton.RIGHT)
E:251
答案: jbt.setHorizontalTextPosition(JButton.RIGHT)
9、 The method ____ specifies that the text and icon are horizontally aligned to the right in the button jbt.
A:jbt.setVerticalTextPosition(JButton.LEFT)
B:jbt.setHorizontalTextPosition(JButton.LEFT)
C:jbt.setHorizontalTextPosition(JButton.RIGHT)
D:jbt.setHorizontalAlignment(JButton.RIGHT)
E:252
答案: jbt.setHorizontalAlignment(JButton.RIGHT)
10、 Analyze the following code:
import javax.swing.;
import javax.swing.border.;
import java.awt.*;
public class Test extends JFrame {
public Test() {
Border border = new TitledBorder(“My button”);
JButton jbt1 = new JButton(“OK”);
JButton jbt2 = new JButton(“Cancel”);
jbt1.setBorder(border);
jbt2.setBorder(border);
add(jbt1, BorderLayout.NORTH);
add(jbt2, BorderLayout.SOUTH);
}
public static void main(String[] args) {
JFrame frame = new Test();
frame.setSize(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
A:Two buttons displayed with the same border.
B:Two buttons displayed, but only one button has the border.
C:The program has a compile error because you assign new TitledBorder(“My button”) to a variable of the Border type.
D:The program has a runtime error because you cannot set a border on a button.
E:253
答案: Two buttons displayed with the same border.
11、 方法_____将获取标签jlbl上的文本。
A:jlbl.text()
B:jlbl.getText()
C:jlbl.findText()
D:jlbl.retrieveText().
E:254
答案: jlbl.getText()
12、 The method ____ specifies that the text is placed on the right of the icon in the label jlbl.
A:jlbl.setVerticalTextPosition(JButton.LEFT)
B:jlbl.setHorizontalTextPosition(JButton.LEFT)
C:jlbl.setHorizontalTextPosition(JButton.RIGHT)
D:jlbl.setHorizontalAlignment(JButton.RIGHT)
E:255
答案: jlbl.setHorizontalTextPosition(JButton.RIGHT)
13、 _____能够输入或者显示一个字符串。
为了方便下次阅读,建议在浏览器添加书签收藏本网页
添加书签方法:
1.电脑按键盘的Ctrl键+D键即可收藏本网页
2.手机浏览器可以添加书签收藏本网页
获取更多MOOC答案,欢迎在浏览器访问我们的网站:http://mooc.mengmianren.com
注:请切换至英文输入法输入域名,如果没有成功进入网站,请输入完整域名:http://mooc.mengmianren.com/
我们的公众号
打开手机微信,扫一扫下方二维码,关注微信公众号:萌面人APP
本公众号可查看各种网课答案,还可免费查看大学教材答案
点击这里,可查看公众号功能介绍
一键领取淘宝,天猫,京东,拼多多无门槛优惠券,让您购物省省省,点击这里,了解详情
干饭人福利,饿了么红包每日领