JAVA PROGRAMMING TENTH EDITION EXAM SCRIPT FINAL PAPER 2026 COMPLETE SOLVED QUESTIONS ALGO, Exams of Java Programming

JAVA PROGRAMMING TENTH EDITION EXAM SCRIPT FINAL PAPER 2026 COMPLETE SOLVED QUESTIONS ALGORITHMS AND DATA STRUCTURES INSIGHT TOOLKIT

Typology: Exams

2025/2026

Available from 05/22/2026

Professor_Beatrice
Professor_Beatrice ๐Ÿ‡บ๐Ÿ‡ธ

5

(1)

49K documents

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JAVA PROGRAMMING TENTH EDITION
EXAM SCRIPT FINAL PAPER 2026
COMPLETE SOLVED QUESTIONS
ALGORITHMS AND DATA STRUCTURES
INSIGHT TOOLKIT
โ—‰ int n1 = 12;
int n2 = 5;
int n3 = ++n1 - n1--;
What is the result of the code above?
Answer: n3 = 8 and n2 = 4 and n1 = 13
โ—‰ Identify the statements that correctly increase the variable
amount by 2. Select ALL that apply.
Answer: Amount += 2;
Amount = amount + 2;
โ—‰ Identify the components of object-oriented programming in Java.
Select ALL that apply.
Answer: Encapsulation
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download JAVA PROGRAMMING TENTH EDITION EXAM SCRIPT FINAL PAPER 2026 COMPLETE SOLVED QUESTIONS ALGO and more Exams Java Programming in PDF only on Docsity!

JAVA PROGRAMMING TENTH EDITION

EXAM SCRIPT FINAL PAPER 2026

COMPLETE SOLVED QUESTIONS

ALGORITHMS AND DATA STRUCTURES

INSIGHT TOOLKIT

โ—‰ int n1 = 12; int n2 = 5; int n3 = ++n1 - n1--; What is the result of the code above? Answer: n3 = 8 and n2 = 4 and n1 = 13 โ—‰ Identify the statements that correctly increase the variable amount by 2. Select ALL that apply. Answer: Amount += 2; Amount = amount + 2; โ—‰ Identify the components of object-oriented programming in Java. Select ALL that apply. Answer: Encapsulation

Inheritance Abstraction Polymorphism โ—‰ Identify the "blueprint" from which individual Java objects are created. Answer: Class โ—‰ This contains the JVM and Java Class Library. Answer: JRE โ—‰ Simple data types for storing integers, real numbers, characters and Booleans are called ____?____ in Java. Answer: primitives โ—‰ int result = 3 / 10; What is the result of the code above? Answer: 0 is stored in result โ—‰ long loan = 1234; int number = loan;

โ—‰ Identify the Java package that is never imported. Answer: java.lang โ—‰ Java's thousands of classes are organized into ? Answer: Packages โ—‰ Identify the correct use of comments. Select ALL that apply. Answer: a. // this is a Java comment b. System.out.println("Hello, World"); // say Hello c. /* This is a Java comment */ โ—‰ Identify the correct statements. Select ALL that apply. Answer: a. A Java string is enclosed by double quotes b. Java programs start in the main method. c. The contents of a class are enclosed by curly braces () d. A compiled Java filename has a .class extension. โ—‰ A device needs a ____ to run a Java program Answer: JVM โ—‰ Identify the true statements about Java. Select ALL that apply. Answer: a. Java is case-sensitive

b. A java program must have at least one class c. Java programs execute from the main method d. The name of a public Java Class must match its filename e. Java class names should begin with an upper case alphabet character โ—‰ What term is used to describe compiled Java code? Answer: Bytecode โ—‰ Source code file Hello.java has been compiled. Which one of these will execute it? Answer: java Hello โ—‰ Where are Java used programs used? Select ALL that apply. Answer: a. In some mobile devices b. On web servers c. In some modern motor vehicles d. In some kitchen appliances โ—‰ Identify the legal Java identifiers. Select ALL that apply. Answer: a. CanOfWorms b. _firstname

โ—‰ 1. This tests if two different objects contain the same string. Answer: The equals method โ—‰ Identify the logical operator(s). Select ALL that apply. Answer: a.! b. ^ c. && โ—‰ Identify the expression(s) that return true if an int named num is between 100 and 200, inclusive. Select ALL that apply. Answer: a. num >= 100 && num <= 200 b. num > 99 && num < 201 โ—‰ int n1 = 12; int n2 = 5; Identify the statement(s) that are true. Select ALL that apply. Answer: a. N2 > 10 ^ n1 > 10 b. N1 > 10 ^ n2 > 10 โ—‰ int var1 = 5, var2 = 6; if ((var2=1) == var1) System.out.print(var2);

Else System.out.print(++var2); What is printed by the code above? Answer: 2 โ—‰ int x = 3; int y = 5; int z = x++ > --y? x : y; System.out.print(z); What (if anything) is printed? Answer: 4 โ—‰ int x, y = 1; x = 10; if(x != 10 && x / 0 == 0) System.out.println(y); Else System.out.println(++y); What is the output of the code above? Answer: 2 โ—‰ Boolean odd = 12 % 2 == 1;

โ—‰ String a = "4"; A+="5"; A+=6; System.out.print(a); Answer: 456 โ—‰ String s1 = "Hello world"; String s2 = s1; Answer: a. The s2 variable holds the string "Hello world". a. The s2 variable holds a reference to the string "Hello world". โ—‰ Identify the method that returns the number of characters in a string. Answer: Length() โ—‰ Match the format specifiers with the data. Answer: a. %d - integer b. %e - scientific notation c. %f - floating point d. %c - character e. %b - Boolean

f. %s - string โ—‰ Identify the true statements regarding Java loops. Select ALL that apply. Answer: a. A while loop might not run at all. b. A do-while loop always runs at least once. c. Loops can be nested in other loops to any depth as desired. โ—‰ A while loop is a ? loop. Answer: Pretest โ—‰ In which instance can a loop not require braces? Answer: When only one statement is to be repeated โ—‰ The Java continue statement causes execution to skip to Answer: The next iteration in the loop โ—‰ Int n; For(n=8; n < 30; n += 5) { // } System.out.print(n);

System.out.print(x); } What is the output of the code above? Answer: 2 3 4 5 6 โ—‰ int z = 2. sum = 0; while (z < 9) { z++; sum = sum + z; } System.out.print(sum); What is the output of the code above? Answer: 42 โ—‰ int b =0, sum =0; while (b < 6) { ++b; if(b % 2 == 0) continue; b++; sum = sum + b; }

System.out.print(sum); When the above program is run, the output would be 13? Answer: False โ—‰ The methods of the Math class are ? methods? Answer: Static โ—‰ A void method does not contain a return statement, but it is possible. Answer: True โ—‰ Identify the true statements about overloaded methods. Select ALL that apply. Answer: a. They must have different modifiers. b. They can have different parameter types. c. They must have the same method name. d. They can have a different number of parameters. โ—‰ What term describes a variable that is declared inside a method? Answer: Local variable โ—‰ A method can return only on value.

Answer: Arguments โ—‰ To be capable of being called in the main method of a Java program, a method defined in the same class must have the ? modifier? Answer: Static โ—‰ public static void main(String[] args) { int number = 10; doubleNum(number); System.out.println(number); } public static void doubleNum(int n) { System.out.println(n * 2); } For the program above what will be the value displayed to the system console in the highlighted text? Answer: 10 โ—‰ public static void main(String[] args) { ArrayList langs = new ArrayList(); lands.add("Java");

lands.add("C++"); lands.add("Python"); lands.add("2,null"); lands.add("2,null"); lands.add("4, "PHP"); for(int i = 0, i < langs.size(); i ++ ) { System.out.print(langs.get(i) + " "); } } What is the output? Answer: Java C++ null null PHP Python โ—‰ Identify the data types that can be stored in a Java ArrayList. Select ALL that apply. Answer: a. Integer b. Double c. String โ—‰ Identify the true statements. Select ALL that apply. Answer: a. Elements can be appended to an existing ArrayList instance.

  1. counts.add(new Integer(8)); Identify the true statement regarding the code above. Answer: No errors, code compiles okay. โ—‰ Identify the true statements. Select ALL that apply. Answer: a. Constructors are called with the new operator. b. Constructors can be overloaded. c. Constructors must have the same name as the class. โ—‰ Identify the true statements. Select ALL that apply. Answer: a. A static method cannot access the data members of its own class. b. Static methods are also called class methods. c. Static methods of a class can be called without instantiating the class. โ—‰ Identify the true statements. Select ALL that apply. Answer: a. Anonymous objects are possible in Java. b. Constants in a class should be declared as final static. c. Static variable and static methods of a class can be accessed by an object of that class and by the class name.

โ—‰ public class Person { private String name; ... What term(s) describe(s) name in the snippet above? Select ALL that apply. Answer: a. Instance variable b. Field c. Data member d. Attribute โ—‰ What does the public visibility modifier mean? Answer: Means accessible from any other classes. โ—‰ Identify the true statements. Select ALL that apply. Answer: a. A getter method has the same return-type as the field it retrieves and takes no parameters. b. A setter method is a return-type void and takes a parameter of the same type as its field. c. Setters and getters are not required for public instance variables. โ—‰ public class Person { private char gender;