How Java Works Flashcards
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
b) Understanding the mechanics of writing and running a Java program
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
c) A formal language with vocabulary and syntax
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
c) An object-oriented, class-based programming language
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
b) Each entity is represented as an object with fields and methods
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) Customer ID, date of birth, and name
What are fields in programming languages also referred to as?
a) Methods
b) Attributes or properties
c) Functions
d) Classes
b) Attributes or properties
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
b) Operate on objects
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
b) The premium can change regularly
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
b) Through the methods of the objects
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
b) A specific type of object-oriented programming language
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
c) What a type of object looks like
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
b) Wrapping up fields and methods into a single unit
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
b) Creating generic and specific types of objects
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
b) Java is platform-independent
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
c) To allow Java programs to run on any operating system