Module 4 Flashcards

1
Q

Which of the following are true about arithmetic expressions?

A. Subtraction is always done after addition

B. 1 + 2 * 3 is equal to 7

C. Multiplication is always done before addition

D. 6 + 4 / 2 is equal to 5

E. 5 * 4 / 4 - 1 is equal to 6

A

B. 1 + 2 * 3 is equal to 7

C. Multiplication is always done before addition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Java Virtual Machine (JVM)?

A. an editor specific to Java

B. a complier

C. a psuedo code generator

D. a language run-time environment

A

D. a language run-time environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Given two variables x and y, which code below swaps the current values of x and y?

A. y = x ; x = y;

B. x = y; y = x;

C. t = x; x = y; y = t;

D. t = x; y = x; y = t;

A

C. t = x; x = y; y = t;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following are derived data types in the Java language?

A. double

B. char

C. []

D. indirection

E. String

A

C. []

E. String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following statements are true regarding an Interactive Development Environment (IDE)? (Check all that apply)

A. An IDE expedites the resolution of runtime problems

B. An IDE is a burden to programmers, but produces faster code

C. An IDE generates algorithms for the programmer

D. An IDE contains access to an editor and a complier so that the programmer can cycle through these steps iteratively and easily before proceeding outside to the runtime environment

A

A. An IDE expedites the resolution of runtime problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following are valid Java variable names?

A. Year2011

B. OVER_THE_TOP

C. over_the_top

D. $MINIMUM

E. 2for_one_sale

A

A. Year2011

B. OVER_THE_TOP

C. over_the_top

D. $MINIMUM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the following statements are true regarding interpreters?

A. They use a three step approach of edit, compile, and run

B. They recompile each statement every time the program runs

C. They use a two step approach that combines the compile and run steps into one step

D. The source code file and the executable file are the same

E. Once a program runs perfectly, interpreters are faster than non-interpretive language programs

A

B. They recompile each statement every time the program runs

C. They use a two step approach that combines the compile and run steps into one step

D. The source code file and the executable file are the same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following are true about Java assignment statements?

A. In a Java assignment statement there can be multiple variables and constants on the left of the assignment operator

B. Java assignment statements use the = operator

C. Java assignment statements can have an arithmetic expression on the right of the assignment operator

D. A Java assignment statement is the same as an algebraic equality statement

A

B. Java assignment statements use the = operator

C. Java assignment statements can have an arithmetic expression on the right of the assignment operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following statements are true regarding the following Java statement? average = (x + y)/2.0

A. This statement contains two variables

B. This statement is an assignment statement

C. If the values of all variables in this statement was always guaranteed to be a round number, all variables would best be defined as integer

D. This statement is an algebraic equality statement

A

B. This statement is an assignment statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a void method in Java?

A. One that requires no inputs

B. One that is called “main”

C. One that requires no static memory

D. One that returns no data

A

D. One that returns no data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does a Java compiler generate?

A. source code

B. object code

C. byte code

D. psuedo code

E. machine language

A

C. byte code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following are valid Java declarations and initializations of variables?

A. boolean true = yes;

B. constant PI = 3.1416;

C. int x = 1000000;

D. char n = “Hello”;

E. short x = 4.26;

A

C. int x = 1000000;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If c equals negative two, what does an equal in the following Java statement?

a = 2 + c++

A. 6

B. 1

C. -2

D. 0

E. 2

A

D. 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which of the following statements are true about Java?

A. Java does not support objects

B. The Java compiler generates machine code

C. A Java program runs on a Java Virtual Machine

D. Java was developed for embedded applications

E. Java was developed at IBM

A

C. A Java program runs on a Java Virtual Machine

D. Java was developed for embedded applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following Java statements correctly declares a constant?

A. double mORTGAGE_RATE = 3.5;

B. final double MRATE = 3.5;

C. constant mORTGAGE_RATE = 3.5;

D. constant MRATE = 3.5;

A

B. final double MRATE = 3.5;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following are true about a software program?

A. A program consists of instructions that accomplish a specific operation

B. A program consists of instructions that can be executed in any order

C. A program is responsible for validating user inputs

D. A set of program instructions is known as an algorithm

E. A program consists of instructions that must be executed in a specific sequence

A

A. A program consists of instructions that accomplish a specific operation

C. A program is responsible for validating user inputs

D. A set of program instructions is known as an algorithm

E. A program consists of instructions that must be executed in a specific sequence

17
Q

Please select all of the following statements which apply to the Eclipse Integrated Development Environment (IDE).

A. Eclipse IDE facilitates the development of Java programs

B. Eclipse should be installed on your system after the installation of the Java language system if you are going to use Eclipse for your IDE

C. Eclipse is one of the many IDEs which may be installed to use the Java language software

D. Eclipse must be used to develop and run Java programs

E. Eclipse replaces the Java Virtual Machine

A

A. Eclipse IDE facilitates the development of Java programs

B. Eclipse should be installed on your system after the installation of the Java language system if you are going to use Eclipse for your IDE

C. Eclipse is one of the many IDEs which may be installed to use the Java language software

18
Q

Which of the following are primitive Java data types?

A. int

B. double

C. String

D. Array

E. integer

A

A. int

B. double

19
Q

Which of the following is a valid method header for the “main” method required in each Java application?

A. private static void main (String [] args)

B. public void main (Strings [] args)

C. public static int main (String [] args)

D. public static void main (String [] args)

E. public static void main (String args)

A

D. public static void main (String [] args)

20
Q

Which of the following are true regarding the general description of keywords in a computer language?

A. Keywords in a language must be recognizable words in a written language

B. A particular keyword is used only in particular ways in a language

C. The meaning of a keyword is determined by the context in which it is used in a program

D. A particular keyword has one or more specialized meanings in the language

E. A particular keyword has the same meaning as its equivalent English word

A

B. A particular keyword is used only in particular ways in a language

C. The meaning of a keyword is determined by the context in which it is used in a program

D. A particular keyword has one or more specialized meanings in the language

21
Q

Which of the following are true regarding Java syntax?

A. Curly braces, {}, always exist in pairs

B. indentation is important to Java

C. a comment starts with \

D. blank lines are ok

E. a single java statement cannot occupy more than one line

A

A. Curly braces, {}, always exist in pairs

D. blank lines are ok

22
Q

In Java, what does the statement c+=a mean?

A. c + c = a

B. c = c + a

C. c = a + 1

D. c + c = a

E. c + 1 = a

A

B. c = c + a

23
Q

Which of the following languages is interpretive?

A. Java

B. BASIC

C. jGRASP

D. C++

A

B. BASIC

24
Q

Which of the following are characteristics of an algorithm?

A. The steps of an algorithm must be performed in a particular order

B. A computer program constitutes an algorithm

C. Algorithms can assume certain input

D. An algorithm is a sequence of instructions

E. Creating an algorithm is usually a trivial task

A

A. The steps of an algorithm must be performed in a particular order

B. A computer program constitutes an algorithm

D. An algorithm is a sequence of instructions

25
Q

Which of the following are true regarding the Java method main?

A. In the declaration of main, the term “public” means that the main method is available from anywhere within the program

B. The method main is called by the Java Virtual Machine when the program is started

C. The method main is called by the Java compiler

D. In the declaration of main, the term “static” means that the main method exists in memory and can be executed without creating an object

A

B. The method main is called by the Java Virtual Machine when the program is started

D. In the declaration of main, the term “static” means that the main method exists in memory and can be executed without creating an object

26
Q

Which of the following statements are true?

A. Java objects are created at execution (run) time

B. Java objects are created by declaration statements that include the class name and object name

C. Java objects are created by the new operator

D. Java objects are created by the complete when you compile your source code

E. Java objects are created by a class declaration in the source file

A

A. Java objects are created at execution (run) time

C. Java objects are created by the new operator

27
Q

The Java SE language system consists of which of the following?

A. a text editor

B. a debugger

C. a runtime environment

D. a compiler

E. an interpreter

A

C. a runtime environment

D. a compiler

28
Q

Which of the following are true about Java string literals?

A. The value of a Java string literal can change

B. When a Java string literal appears within the parenthesis of a println statement, it will print out exactly as it appears

C. A Java string literal can contain letters of the alphabet and the digits 0 through 9

D. A Java string literal is delimited by single quotes

A

B. When a Java string literal appears within the parenthesis of a println statement, it will print out exactly as it appears

C. A Java string literal can contain letters of the alphabet and the digits 0 through 9

29
Q

The programming process in Java includes which of the following activities?

A. Determining what the program is supposed to accomplish

B. Writing machine code

C. Developing invalid input as test data

D. Resolving all program logic errors

E. Determining program output display

A

A. Determining what the program is supposed to accomplish

C. Developing invalid input as test data

D. Resolving all program logic errors

E. Determining program output display

30
Q

Which of the following are true about logic errors?

A. Logic errors are detected at runtime

B. Logic errors potentially result in incorrect program output

C. Logic errors must be fixed before testing

D. Logic errors are detected by analyzing the operation of a program

E. Logic errors are detected by the compiler

A

A. Logic errors are detected at runtime

B. Logic errors potentially result in incorrect program output

D. Logic errors are detected by analyzing the operation of a program

31
Q

Which of the following are true about the Java statement?
public static void main (String[] args)

A. It is a class header

B. You can leave out the word “static” if you like

C. It is always required in a Java application program

D. It is a method header

E. The word “main” is user defined, you can call it anything you like

A

C. It is always required in a Java application program

D. It is a method header