2021 Java语言程序设计E(武汉理工大学) 最新满分章节测试答案

2024年11月13日 分类:免费网课答案 作者:网课帮手

本答案对应课程为:点我自动跳转查看
本课程起止时间为:2021-06-16到2021-07-18
本篇答案更新状态:已完结

复习测试

1、 问题:What is best to describe the relationship between Component and Font?
选项:
A:Association
B:Aggregation
C:Composition
D:Inheritance
E:244
答案: 【Association

2、 问题:下面三个表达式中,正确的是 _____.

  1. frame.setLocationRelativeTo(null);
  2. frame.setSize(100, 200);
  3. 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、 问题:_____能够输入或者显示一个字符串。
选项:

本门课程剩余章节答案为付费内容
本文章不含期末不含主观题!!
本文章不含期末不含主观题!!
支付后可长期查看
有疑问请添加客服QQ 2356025045反馈
如遇卡顿看不了请换个浏览器即可打开
请看清楚了再购买哦,电子资源购买后不支持退款哦
请输入手机号或商家订单号
打不开请联系客服QQ 2356025045 商家订单号在哪里?点此了解

商家订单号查看步骤

打开支付宝
方法一:我的 > 账单 > 账单详情 > 更多>复制商家订单号
方法二:我的 > 账单 >搜索关键字【网课小帮手】
> 账单详情 > 更多>复制商家订单号
方法三:联系客服QQ 2356025045
微信支付
我 > 支付 > 钱包 > 账单 > 账单详情

继续阅读