Unit 1 Flashcards
What type of code is typed into a .java file?
a. class file
b. source file
c. java file
b. source code
Source code is compiled to produce what type of file for each class you define
a. .class file
b. .java file
c. .java.lang file
a. .class file
One .class file must contain a method called _____ (which accepts only an array of Strings) which the Java Virtual Machine will call to start the program running
a. .class file
b. .java.lang file
c. main file
c. main file
what is the correct term for the following
class Person
what is Person here?
identifier
what is the correct term for the following
public static void main(String[] args)
what is static void here?
keywords
a java program
is a collection of 1 or more __________?
a. methods
b. attributes
c. classes
c. classes
1 java class MUST contain the method called __________
main method
_________ never returns a value
a. void
b. static
c. return
a void
_______ keyword is used only one per class, not one per object
a. void
b. int
c. static
d. boolean
c. static
1 byte = ________ bits
8
bits consists of
a. 1s and 1s
b. 0s and 1s
c. 0s and 0s
b. 0s and 1s
A ________ value is a value which we directly type into the code
a. literal
b. direct
c. constant
a. literal
‘\n ‘ precedented backslash is used for
a. previous line
b. new line
c. next string
b. new line
what is the example of char
a. ‘\r’
b. 1
c. name
d. 1.0
a. ‘\r’
what is this?
int myInteger = 5;
a. assignment
b. instantiation
c. declaration
c. declaration
Words and sentences that are stored in memory can be considered as a sequence of individual characters in __________ class
a. integer class
b. main method
c. String class
c. String class
pay *= 1.2 is equivalent to
a. pay * 1.2
b. pay * = pay * 1.2
c. pay = pay * 1.2
c. pay = pay * 1.2
total = total + sub * sub;
is equivalent to
a. total +=sub * sub;
b. total = +sub * sub;
c. total = sub + sub * sub;
a. total +=sub * sub;
total– is equivalent to
a. total = total - 1
b. total -1
a. total = total - 1
a = 6;
b = ++a - 1;
then b =
a. b = 6
b. b = 7
c. b = 5
a. b = 6
x + 3 <= y * 5
a. expression
b. variable
a. expression
int a= 1, b= 2, c = 3, d ;
if ((a<b) || (c < a))
d = 10;
else
d = 20;
d= 10
for (ctr = 1; ctr < 10; ctr ++){
System.out.print(ctr * ctr);
System.out.print(“ ”);
a. 1 4 9 16 25 36 49 64 81
b. 1 3 8 15 24 36 47 62 80
c. 1 4 9 16 25 35 48 64 81
a. 1 4 9 16 25 36 49 64 81
which loop to use when the number of iterations is known
a. for loop
b. do while loop
c. case statement
a. for loop
which loop runs at least once
do while loop
int number = 1;
marks[number] = 38;
what index number will store 38?
a. marks [0]
b. marks[number]
c. marks[1]
c. marks[1]
public static void introduction()
{
String name = “Thomas”;
int age = 40;
System.out.println(“My name is “ + name +
“ and I am “ + age +
“ years old.”);
}
what is the name of the method?
introduction()