How Java Works Flashcards

1
Q

What is the first step in understanding how the Java programming language works?

a) Learning about Java libraries
b) Understanding the mechanics of writing and running a Java program
c) Studying Java frameworks
d) Learning about Java syntax

A

b) Understanding the mechanics of writing and running a Java program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a programming language compared to?

a) A mathematical formula
b) A set of tools
c) A formal language with vocabulary and syntax
d) A computer hardware component

A

c) A formal language with vocabulary and syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is Java defined?

a) A procedural programming language
b) A scripting language
c) An object-oriented, class-based programming language
d) A functional programming language

A

c) An object-oriented, class-based programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does ‘object-oriented’ mean in the context of Java?

a) Each entity is represented as a function
b) Each entity is represented as an object with fields and methods
c) Each entity is represented as a variable
d) Each entity is represented as a loop

A

b) Each entity is represented as an object with fields and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What fields might an object representing a customer include?

a) Customer ID, date of birth, and name
b) Product ID, price, and quantity
c) Book title, author, and ISBN
d) Employee ID, department, and salary

A

a) Customer ID, date of birth, and name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are fields in programming languages also referred to as?

a) Methods
b) Attributes or properties
c) Functions
d) Classes

A

b) Attributes or properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do methods in an object allow us to do?

a) Store static values
b) Operate on objects
c) Define classes
d) Create new programming languages

A

b) Operate on objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why might a method be used to calculate an insurance premium rather than a field?

a) The premium is static
b) The premium can change regularly
c) Fields are not used in programming
d) Methods cannot perform calculations

A

b) The premium can change regularly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is access to the fields of an object usually granted?

a) Directly through the fields
b) Through the methods of the objects
c) By creating new objects
d) By defining new classes

A

b) Through the methods of the objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a class-based language?

a) A language that does not use objects
b) A specific type of object-oriented programming language
c) A language that only uses functions
d) A language that does not use methods

A

b) A specific type of object-oriented programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does a class describe in a class-based language?

a) Specific instances of objects
b) The syntax of the language
c) What a type of object looks like
d) The hardware requirements

A

c) What a type of object looks like

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is encapsulation in class-based languages?

a) The process of defining new languages
b) Wrapping up fields and methods into a single unit
c) Creating new programming paradigms
d) Writing syntax rules

A

b) Wrapping up fields and methods into a single unit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does inheritance allow in class-based languages?

a) Defining new programming languages
b) Creating generic and specific types of objects
c) Writing functions without classes
d) Storing static values

A

b) Creating generic and specific types of objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does it mean for Java to have as few implementation dependencies as possible?

a) Java is dependent on specific hardware
b) Java is platform-independent
c) Java requires multiple versions for different platforms
d) Java is only compatible with Windows

A

b) Java is platform-independent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the role of the Java Virtual Machine (JVM)?

a) To compile Java code
b) To run Java programs directly on the operating system
c) To allow Java programs to run on any operating system
d) To write Java code

A

c) To allow Java programs to run on any operating system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Who maintains the Java programming language?

a) Microsoft
b) Google
c) Oracle Corporation
d) IBM

A

c) Oracle Corporation

17
Q

What does the JVM do to ensure platform independence?

a) It compiles Java code into machine-specific code
b) It translates Java code into system calls for the operating system
c) It runs Java programs directly on the hardware
d) It converts Java code into Python code

A

b) It translates Java code into system calls for the operating system

18
Q

What is required from programmers to ensure their Java programs run on multiple platforms?

a) Write separate programs for each platform
b) Write a Java program that can run on a JVM
c) Modify the operating system
d) Use platform-specific libraries

A

b) Write a Java program that can run on a JVM