









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
COMP 308 JAVA FOR PROGRAMMERS FINAL EXAM SCRIPT 2026 TIPS POSSIBLE QUESTIONS TEST BANK SOLVED 100% ACCURATE
Typology: Exams
1 / 15
This page cannot be seen from the preview
Don't miss anything!










⩥ What is the Java platform? Answer: - The software that Java runs on top of other hardware-based platforms
something in the code goes wrong. Java forces you to use exception handling ⩥ What are the functions of threads in single-processor and multi- processor environments? Answer: ⩥ What is the primary idea of a client/server system? Answer: The primary idea of a client/server system is that you have a central repository of information—some kind of data, usually in a database— that you want to distribute on demand to some set of people or machines ⩥ How did Web serving lead to client-side programming? Answer: The web needed to be more interactive and fast, and thus needed client side programming as a way to allow programs to be run under the client's end. ⩥ What is CGI programming and what is its major shortcoming? Answer: CGI (Common Gateway Interface) allows dynamic interaction between users and a web page. It's major shortcoming is that it is slow and makes certain tasks such as dynamic graphing difficult ⩥ Why is client-side programming efficient for the web? Answer: ⩥ What is a plug in? Answer: a software component that adds a specific feature to a browser
⩥ What is a scripting language? Answer: With a scripting language, you embed the source code for your client-side program directly into the HTML page, and the plug-in that interprets that language is automatically activated while the HTML page is being displayed. ⩥ Compare the scripting languages to Java for Web page needs Answer: ⩥ What are the issues of intranet vs internet programming? Answer: page 58 ⩥ What is the role of Java in server-side programming? Answer: ⩥ What is the difference between an object and its handle? Answer: a handle is a reference to the object and not the object itself, and the object is the actual data ⩥ What are the roles of registers, the stack, the heap, constant storage, and non-RAM storage in Java programming? (See TIJ pages 63 to 64.) Answer: - Registers: fastest storage because it exists inside the processor, unlike other storage, limited space
primitive types that are members of a class will default to primitive types if not instantiated, whereas in local variables they will not compile ⩥ What are the fundamental parts of a Java method? (See TIJ page 72.) Answer: name, arguments, return type, and body ⩥ What is the naming convention when creating Java libraries for public distribution? (See TIJ pages 74 to 75.) Answer: Name the library, use your internet domain name in reverse (ex. com.mindview) ⩥ What is the purpose of the import keyword? (See TIJ page 75.) Answer: import tells the compiler to bring in a package (a library of classes) ⩥ What are the functions of the static keyword? (See TIJ pages 76 to 78.) Answer: Static means the field or method is not tied to any particular object instance of the class. functions? ⩥ In Java, what is the standard coding style for classes and methods? (See TIJ pages 88 to 89.) Answer: Capitalize the first letter of a class name, and everything else remains in all lowercase ⩥ What is the precedence among arithmetic operators? (See TIJ page 95.) Answer: multiplication and division happen before addition and subtraction
⩥ What is the difference in assignment between primitives and objects? Answer: When assigning primitives you copy the contents from one place to another, whereas when assigning one object to another you are really assigning one reference to another ⩥ What is aliasing? (See TIJ pages 97 to 98.) Answer: ⩥ What are the mathematical operators? (See TIJ pages 98 to 101.) Answer: +, - , /, *, % ⩥ How do auto pre-increment, pre-decrement, post-increment, and post- decrement work? (See TIJ pages 101 to 103.) Answer: *** pre-increment: ++a post-increment: a++ pre-decrement: --a post-decrement: a-- ⩥ What are the relational operators? (See TIJ page 103.) Answer: <, >, <=, >=, == ⩥ How does one test for object equivalence? (See TIJ pages 103 to 105.) Answer: using the equals() method ex.
after it has been shifted to the left by the number of bits specified to the right of the operator (inserting zeroes at the lower-order bits). The signed right-shift operator (>>) produces the operand to the left of the operator after it has been shifted to the right by the number of bits specified to the right of the operator. The signed right shift >> uses sign extension: If the value is positive, zeroes are inserted at the higher-order bits; if the value is negative, ones are inserted at the higher-order bits. These can only be used on primitive, integral types ⩥ How does the ternary if-else operator work? (See TIJ pages 116 to 118.) Answer: boolean-exp? value0 : value If the boolean evaluates to true, value0 is evaluated, and its result becomes the value produced by the operator. If it evaluates to false, value1 is evaluated. ⩥ What is the function of the string + operator? (See TIJ pages 118 to 119.) Answer: Used to concatenate strings ⩥ How does explicit casting work in Java? (See TIJ pages 120 to 121.) Answer: Casting changes one type of data into another when appropriate. You can cast any primitive type to any other primitive type, except Boolean ⩥ What are the two basic forms of if? (See TIJ pages 135 to 136.) Answer: if(Boolean-expression) statement
if(Boolean-expression) statement else statement ⩥ How does while differ from do-while? (See TIJ pages 137 to 138.) Answer: the statement of do-while always executes at least one, even if the expression evaluates to false the first time ⩥ What is unique to the for statement in regard to defining variables? (See TIJ pages 138 to 139.) Answer: The scope of a variable can be the statement controlled by the for loop ⩥ What is the function of the comma operator? (See TIJ page 140.) Answer: Separation of statements to be evaluated sequentially ⩥ What is the equivalence of a for loop in foreach syntax? (See TIJ page 141). Answer: for(x:f) ******
⩥ What is a default constructor? (See TIJ pages 166 to 167.) Answer: A default constructor (AKA no-arg constructor) is used to create a "default object" ⩥ How is the keyword this used in Java? (See TIJ pages 167 to 168.) Answer: produces the reference to the object that the method has been called for ⩥ What is the purpose of finalize? (See TIJ pages 173 to 174.) Answer: the finalize method should work when the garbage collector calls it, and only on the next garbage collector pass will it reclaim the objects memory ⩥ Why is finalize not good as a destructor? (See TIJ pages 173 to 175.) Answer: If you use finalize(), your objects might not get garbage collected, and garbage collection is not destruction. ⩥ Why must one perform clean up? (See TIJ page 175.) Answer: Avoid memory leaks and ensure storage is released when it is no longer needed ⩥ What are the initial values of primitives that are encapsulated in an object, and what are the initial values of primitives that are not encapsulated in an object? (See TIJ pages 181 to 183.) Answer: ***
⩥ What is the advantage of constructor initialization? (See TIJ page 185.) Answer: Gives greater flexibility in your programming because you can call methods and perform actions at run time to determine the initial values ⩥ When are variables in an object initialized? (See TIJ pages 185 to 186.) Answer: Once before and once after the constructor call ⩥ What are the steps in the process of creating an object? (See TIJ page 189.) Answer: consider a class called Dog: