Java Programming

Java Programming

University

30 Qs

quiz-placeholder

Similar activities

Neo Coding Round 1 Set 2

Neo Coding Round 1 Set 2

University

25 Qs

Introduction to Java Programming

Introduction to Java Programming

University

25 Qs

SD_Prelim Exam

SD_Prelim Exam

University

25 Qs

JAVA

JAVA

University

30 Qs

Android Quiz

Android Quiz

10th Grade - Professional Development

25 Qs

Java Introduction

Java Introduction

University

25 Qs

Android Studio

Android Studio

10th Grade - Professional Development

25 Qs

DEBUGGING

DEBUGGING

University

26 Qs

Java Programming

Java Programming

Assessment

Quiz

Computers

University

Medium

Created by

undefined Nur Shamilla Binti Selamat

Used 4+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to create a button using Java Swing?

Button button = new Button();

JButton button = new JButton();

JLabel button = new JLabel();

JFrame button = new JFrame();

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to add a button to a frame in Java GUI?

frame.add(button);

button.add(frame);

new Button().add(frame);

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to set the text of a button in Java GUI?

button.setText("Hello, world!");

new Button("Hello, world!");

button.setLabel("Hello, world!");

button.setTitle("Hello, world!");

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to create a label in Java GUI?

Label label = new Label();

JButton label = new JButton();

JFrame label = new JFrame();

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax to add a label to a frame in Java GUI?

frame.add(label);

label.add(frame);

new Label().add(frame);

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not an exception handling keyword in Java?

try

catch

finally

if

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the try block in exception handling?

To execute a block of code that may throw an exception

To catch an exception and handle it

To execute a block of code that must be executed, regardless of whether an exception is thrown

To close all resources that were opened in the try block

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?