CSIT-111 FINAL EXAM PRACTICE, Exams of Computer Fundamentals

A method defined in a class can access the class' instance data without needing to pass them as parameters or declare them as local variables. - answer- True Every class definition must include a constructor. - answer- False While multiple objects of the same class can exist, in a given program there can be only one version of each class. - answer- True Accessors and mutators provide mechanisms for controlled access to a well-encapsulated class. - answer- True All Java classes must contain a main method which is the first method executed when the Java class is called upon. - answer- False As in the other members of the C family of languages (C, C++, C#), Java interprets a zero value as false and a non-zero value as true. - answer- True In Java, selection statements consist of the if and if-else statements. - answer- False In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably). - answer- False

Typology: Exams

2025/2026

Available from 04/30/2026

ThinkTrek
ThinkTrek 🇺🇸

718 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIT-111 FINAL EXAM PRACTICE |VERIFIED
QUESTIONS AND ANSWERS 100% A *
A method defined in a class can access the class' instance data without needing to pass them as
parameters or declare them as local variables. - answer- True
Every class definition must include a constructor. - answer- False
While multiple objects of the same class can exist, in a given program there can be only one
version of each class. - answer- True
Accessors and mutators provide mechanisms for controlled access to a well-encapsulated class. -
answer- True
All Java classes must contain a main method which is the first method executed when the Java
class is called upon. - answer- False
As in the other members of the C family of languages (C, C++, C#), Java interprets a zero value
as false and a non-zero value as true. - answer- True
In Java, selection statements consist of the if and if-else statements. - answer- False
In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably). - answer-
False
When comparing any primitive type of variable, == should always be used to test to see if two
values are equal. - answer- False
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CSIT-111 FINAL EXAM PRACTICE and more Exams Computer Fundamentals in PDF only on Docsity!

CSIT-111 FINAL EXAM PRACTICE |VERIFIED

QUESTIONS AND ANSWERS 100% A *

A method defined in a class can access the class' instance data without needing to pass them as parameters or declare them as local variables. - answer- True Every class definition must include a constructor. - answer- False While multiple objects of the same class can exist, in a given program there can be only one version of each class. - answer- True Accessors and mutators provide mechanisms for controlled access to a well-encapsulated class. - answer- True All Java classes must contain a main method which is the first method executed when the Java class is called upon. - answer- False As in the other members of the C family of languages (C, C++, C#), Java interprets a zero value as false and a non-zero value as true. - answer- True In Java, selection statements consist of the if and if-else statements. - answer- False In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably). - answer- False When comparing any primitive type of variable, == should always be used to test to see if two values are equal. - answer- False

The statement if (a >= b) a++; else b--; will do the same thing as the statement if (a < b) b--; else a++;. - answer- True An if statement may or may not have an else clause, but an else clause must be part of an if statement. - answer- True In order to compare int, float and double variables, you can use <, >, ==, !=, <=, >=, but to compare char and String variables, you must use compareTo( ), equals( ) and equalsIgnoreCase( ). - answer- False Control in a switch statement jumps to the first matching case. - answer- True Each case in a switch statement must terminate with a break statement. - answer- False It is possible to convert any type of loop (while, do, or for) into any other. - answer- True The following loop is syntactically valid. for (int j = 0; j < 1000; j++) j--; - answer- True A dialog box is a device which accepts voice commands. - answer- False For the questions below, assume that boolean done = false, int x = 10, int y = 11, String s = "Help" and String t = "Goodbye". The expression (!done && x <= y) is true. - answer- True

A. What is a Java Virtual Machine? Explain its role. Answer: A Java Virtual Machine (JVM) is a software interpreter that executes Java bytecode. Since bytecode is a low-level representation of a program, but not tied to any particular hardware architecture, any computer with a JVM can execute Java code, no matter what machine it was compiled on. That makes Java architecture-neutral, and therefore highly portable. B. What do we mean when we say that the English language is ambiguous? Give two examples of English ambiguity (other than the example used in this chapter) and explain the ambiguity. Why is ambiguity a problem for programming languages? Answer: Something is ambiguous if it has two or more possible meanings. For example, the statement, "Mary is the nicest teaching assistant who has helped me all day long" might mean 1) of all the teaching assistants who have helped me today, Mary is the nicest, or

  1. of those - answer- A. Both A. and B are true public class Questions1_ { public static void main(String[ ] args) { System.out.print("Here"); System.out.println("There " + "Everywhere"); System.out.println("But not" + "in Texas"); } } - answer- C) "There Everywhere" on the same line as "Here" The final println command will output - answer- B) "But notin Texas"

How many lines of output are provided by this program? - answer- 2 System.out.println("1 big bad wolf\t8 the 3 little pigs\n4 dinner\r2night"); This statement will output how many lines of text - answer- 2 The word println is a(n) - answer- a. method What value will z have if we execute the following assignment statement? float z = 5 / 10; - answer- a. z will equal 0. A cast is required in which of the following situations? - answer- storing a float in an int Given the following assignment statement, which of the following answers is true regarding the order that the operators will be applied based on operator precedence? a = (b + c) * d / e - f; - answer- +, *, /, - What is output with the statement System.out.println(x+y); if x and y are int values where x=10 and y=5? - answer- a. 15 Which of the following would return the last character of the String x? - answer- x.charAt(x.length( )-1);

Which of the following reserved words in Java is used to create an instance of a class? - answer- e. new Consider a sequence of method invocations as follows: main calls m1, m1 calls m2, m2 calls m and then m2 calls m4, m3 calls m5. If m4 has just terminated, what method will resume execution? - answer- b. m In a UML diagram for a class - answer- E) all of the above A) classes are represented as rectangles B) there may be a section containing the name of the class C) there may be a section containing the attributes (data) of the class D) there may be a section containing the methods of the class How many times will the following loop iterate? int x = 10; while (x > 0) { System.out.println(x); x--; } - answer- d. 10 times Which of the following are true statements about check boxes? - answer- e. all of the above The idea that program instructions execute in order (linearly) unless otherwise specified through a conditional statement is known as - answer- e. flow of control

Of the following if statements, which one correctly executes three instructions if the condition is true? - answer- d. if (x < 0) { a = b * 2; y = x; z = a - y; } Given the nested if-else structure below, answer questions below. if (a > 0) if (b < 0) x = x + 5; else if (a > 5) x = x + 4; else x = x + 3; else x = x + 2; If x is currently 0, a = 5 and b = 5, what will x become after the above statement is executed? - answer- c. 3 Consider the following code that will assign a letter grade of 'A', 'B', 'C', 'D', or 'F' depending on a student's test score. if (score >= 90) grade = 'A'; if (score >= 80) grade = 'B'; if (score >= 70) grade = 'C'; if (score >= 60) grade = 'D'; else grade = 'F'; - answer- d. This code will work correctly only if grade < 70

Condition 3: !(true && false) Condition 4: (x > y || a == 'A' || d != 'A') - answer- d. Conditions 2, 3 and 4 are all true, Condition 1 is not If a break occurs within the innermost loop of a nested loop that is three levels deep - answer- a. when the break is encountered just the innermost loop is "broken" Every Interator - answer- a. has a hasNext( ) method If x is an int where x = 1, what will x be after the following loop terminates? while (x < 100) x *= 2; - answer- d. 128 If x is an int where x = 0, what will x be after the following loop terminates? while (x < 100) x *= 2; - answer- e. none of the above, this is an infinite loop Given the following switch statement where x is an int, answer the questions below switch (x) { case 3 : x += 1; case 4 : x += 2; case 5 : x += 3; case 6 : x++; case 7 : x += 2; case 8 : x--;

case 9 : x++ }

  1. If x is currently equal to 5, what will the value of x be after the switch statement executes? - answer- c. 11, i think this is wrong but dolezal thinks its true The statement if (x < 0) y = x; else y = 0; can be rewritten using a conditional operator as - answer- a. y = (x < 0)? x : 0; How many times will the following loop iterate? int x = 10; do { System.out.println(x); x--; } while (x > 0); - answer- e. 11 times Given that s is a String, what does the following loop do? for (int j = s.length( ); j > 0; j--) System.out.print(s.charAt(j-1)); - answer- a. it prints s out backwards The following nested loop structure will execute the inner most statement (x++) how many times? for (int j = 0; j < 100; j++) for (int k = 100; k > 0; k--) x++; - answer- c. 10,