Docsity

Java Programming, 10th Edition (Joyce Farrell) – Full Practice Exam: 100+ Multiple-Choic, Exams of Nursing

Toggle sidebar
bg1
Java Programming, 10th Edition (Joyce Farrell) – Full Practice Exam: 100+
Multiple-Choice Questions with Verified Answers & Detailed Rationales | Covers
All Chapters (1–10) | Ideal for Final Exam ReviewJava Programming, 10th
Edition by Joyce Farrell – Comprehensive Practice Test Bank
Chapter 1: Creating Java Programs
Q1: Languages that let you use an easily understood vocabulary of descriptive
terms, such as read, write, or add, are known as ____________ languages.
• A) procedural
• B) high-level
• C) machine
• D) object-oriented
☑VERIFIED ANSWER: B – high-level
Rationale: High-level languages use English-like terms to make programming
more accessible to humans. Java is an example of a high-level language. In
contrast, machine language uses binary (1s and 0s), procedural languages execute
a series of procedures, and object-oriented programming focuses on objects
containing data and methods.
Q2: The rules of a programming language constitute its ____________.
• A) syntax
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40

Partial preview of the text

Download Java Programming, 10th Edition (Joyce Farrell) – Full Practice Exam: 100+ Multiple-Choic and more Exams Nursing in PDF only on Docsity!

Java Programming, 10th Edition (Joyce Farrell) – Full Practice Exam: 100+ Multiple-Choice Questions with Verified Answers & Detailed Rationales | Covers All Chapters (1–10) | Ideal for Final Exam ReviewJava Programming, 10th Edition by Joyce Farrell – Comprehensive Practice Test Bank Chapter 1: Creating Java Programs Q1: Languages that let you use an easily understood vocabulary of descriptive terms, such as read, write, or add, are known as ____________ languages.

  • A) procedural
  • B) high-level
  • C) machine
  • D) object-oriented ☑VERIFIED ANSWER : B – high-level Rationale: High-level languages use English-like terms to make programming more accessible to humans. Java is an example of a high-level language. In contrast, machine language uses binary (1s and 0s), procedural languages execute a series of procedures, and object-oriented programming focuses on objects containing data and methods. Q2: The rules of a programming language constitute its ____________.
  • A) syntax
  • B) logic
  • C) format
  • D) objects ☑VERIFIED ANSWER : A – syntax Rationale: Syntax refers to the set of rules that defines the structure of a programming language. Logic refers to the reasoning behind program design, format is a general term, and objects are components of object-oriented programming. Q3: A ____________ translates high-level language statements into machine code.
  • A) programmer
  • B) syntax detector
  • C) compiler
  • D) decipherer ☑VERIFIED ANSWER : C – compiler Rationale: A compiler translates high-level programming statements into lowlevel machine code that the computer can execute. Programmers write the code, while "syntax detector" and "decipherer" are not standard programming terms.

Q6: Envisioning program components as objects that are similar to concrete objects in the real world is the hallmark of ____________.

  • A) command-line operating systems
  • B) procedural programming
  • C) object-oriented programming
  • D) machine languages ☑VERIFIED ANSWER : C – object-oriented programming Rationale: Object-oriented programming (OOP) models real-world entities as objects that have attributes (data) and behaviors (methods). Procedural programming focuses on step-by-step procedures, while machine language and command-line systems are not programming paradigms. Q7: The values of an object's attributes are known as its ____________.
  • A) state
  • B) orientation
  • C) methods
  • D) condition

☑VERIFIED ANSWER : A – state Rationale: In object-oriented programming, the current values of an object's attributes define its state. Methods define behaviors, while orientation and condition are not standard OOP terms. Q8: An instance of a class is a(n) ____________.

  • A) method
  • B) procedure
  • C) object
  • D) case ☑VERIFIED ANSWER : C – object Rationale: A class is a blueprint or template, and an object is a specific instance created from that class. Methods and procedures define behaviors, not instances. Q9: Java is architecturally ____________.
  • A) neutral
  • B) oriented
  • C) specific
  • D) abstract

☑VERIFIED ANSWER : D – semicolon Rationale: In Java, every statement must be terminated with a semicolon (;). This includes declarations, assignments, method calls, and other executable statements. Q12: Arguments to methods always appear within ____________.

  • A) parentheses
  • B) double quotation marks
  • C) single quotation marks
  • D) curly braces ☑VERIFIED ANSWER : A – parentheses Rationale: In Java, method arguments are always enclosed in parentheses following the method name. Curly braces define code blocks, and quotation marks denote string or character literals. Q13: In a Java program, you must use ____________ to separate classes, objects, and methods.
  • A) commas
  • B) semicolons
  • C) dots
  • D) forward slashes ☑VERIFIED ANSWER : C – dots Rationale: The dot operator (.) is used in Java to access members of a class or object. For example, System.out.println() uses dots to separate the class, object, and method. Q14: All Java applications must have a method named ____________.
  • A) method()
  • B) main()
  • C) java()
  • D) Hello() ☑VERIFIED ANSWER : B – main() Rationale: The main() method is the entry point for all Java applications. The JVM starts program execution by calling this method. While other method names are possible, main() is required for application startup. Q15: Nonexecuting program statements that provide documentation are called ____________.
  • A) classes
  • B) notes
  • A) coding
  • B) compiling
  • C) saving
  • D) debugging ☑VERIFIED ANSWER : D – debugging Rationale: While debugging is important, a program can run (though possibly produce incorrect results) even with logic errors. Coding, compiling, and saving are essential prerequisites for program execution. Q18: The command to execute a compiled Java application is ____________.
  • A) run
  • B) execute
  • C) javac
  • D) java ☑VERIFIED ANSWER : D – java Rationale: The java command executes a compiled Java program (bytecode). The javac command compiles source code, while run and execute are not standard Java commands.

Q19: You save text files containing Java source code using the file extension ____________.

  • A) .java
  • B) .class
  • C) .txt
  • D) .src ☑VERIFIED ANSWER : A – .java Rationale: Java source files use the .java extension. After compilation, the resulting bytecode files use the .class extension. The .txt extension is for plain text files. Q20: Java is architecturally neutral. This means that:
  • A) Java programs are independent of any specific operating system
  • B) Java only runs on Windows
  • C) Java requires a specific processor type
  • D) Java cannot be used for web development ☑VERIFIED ANSWER : A – Java programs are independent of any specific operating system

Q23: Multiplication, division, and remainder always take place after addition or subtraction in an expression.

  • A) True
  • B) False ☑VERIFIED ANSWER : B – False Rationale: In Java, multiplication (*), division (/), and remainder (%) have higher precedence than addition (+) and subtraction (-). These operations are performed before addition and subtraction unless parentheses override the order. Q24: Primitive types serve as the building blocks for more complex data types, called ____ types.
  • A) integer
  • B) literal
  • C) reference
  • D) data ☑VERIFIED ANSWER : C – reference Rationale: Primitive types (int, double, boolean, char, etc.) are the basic data types. Reference types (classes, arrays, interfaces) are built from these primitive types and store references to objects rather than the actual data.

Q25: ____ refers to the order in which values are used with operators.

  • A) Associativity
  • B) Initialization
  • C) Declaration
  • D) Floating ☑VERIFIED ANSWER : A – Associativity Rationale: Associativity determines the order in which operators of the same precedence are evaluated. For example, most binary operators have left-to-right associativity, while assignment operators have right-to-left associativity. Q26: A ____ data type can hold 14 or 15 significant digits of accuracy.
  • A) double
  • B) float
  • C) char
  • D) boolean ☑VERIFIED ANSWER : A – double Rationale: The double data type provides about 15-16 significant decimal digits of precision and is the default choice for floating-point numbers in Java. float provides only about 6-7 significant digits.

Q29: You use ____ operators to perform calculations with values in your programs.

  • A) calculation
  • B) arithmetic
  • C) integer
  • D) precedence ☑VERIFIED ANSWER : B – arithmetic Rationale: Arithmetic operators (+, - , *, /, %) perform mathematical calculations on numeric values. These operators are fundamental to performing computations in Java programs. Q30: ____ occurs when both of the operands are integers.
  • A) Data modeling
  • B) Type cast
  • C) Integer division
  • D) Unlike assignment ☑VERIFIED ANSWER : C – Integer division Rationale: When both operands of the division operator (/) are integers, Java performs integer division, which truncates (discards) the fractional part. To get floating-point division, at least one operand must be a floating-point type. Q31: The ____ is the type to which all operands in an expression are converted so that they are compatible with each other.
  • A) unifying type

Q33: Each primitive type in Java has a corresponding class contained in the java.lang package. These classes are called ____ classes.

  • A) wrapper B) primitive
  • C) reference
  • D) object ☑VERIFIED ANSWER : A – wrapper Rationale: Wrapper classes (Integer, Double, Boolean, Character, etc.) "wrap" primitive values in objects. They provide utility methods and allow primitives to be used in contexts requiring objects, such as collections. Q34: Which of the following is NOT a component of a variable declaration statement?
  • A) data type identifier
  • B) symbolic constant
  • C) variable name
  • D) ending semicolon ☑VERIFIED ANSWER : B – symbolic constant

Rationale: Variable declaration statements include a data type, variable name, and ending semicolon (and optionally an initial value). Symbolic constants are declared using the final keyword and are not part of a standard variable declaration.