Midterm Flashcards
Which of these is not a primitive data type in Java?
a. int
b. String
c. float
d. Boolean
b. String
In System.out.println(“hello world”); System is a ________, println is a _________ and “hello world” is a _________
a. method, class, return-type
b. class, parameter, method
c. variable, method, parameter
d. class, method, parameter
d. Class, method, parameter
The formula for the volume of a sphere is
V= 4/3πr^3
In Java, the radius is saved as a double variable r. To calculate volume in Java we write
a. double v = 4Math.PIMath.pow(r, 3)/3;
b. double v = 4Math.PI()rrr/3;
c. double v = (4/3)Math.PIMath.pow(r, 3);
d. double v = (Math.PI()Math.pow(r, 3)4)/3;
a. double v = 4Math.PIMath.pow(r, 3)/3;
Scanner x = new Scanner(System.in); How would be input an integer and save it in variable count.
a. int count = input.nextInt;
b. int count = input.nextInt();
c. int count = x.nextInt;
d. int count = x.nextInt();
d. int count = x.nextInt();
The command to compile a file HelloWorld.java is
javac HelloWorld
To use the debugger in Eclipse, we create _____________ in the program where execution will pause and allow us to inspect variables.
Breakpoints
double x = 3.4567;
Which of these will print 3.46
a. System.out.print(x);
b. System.out.printf(“%.2f”, x);
c. System.out.printf(“%.3f”, x);
d. System.out.printf(“%f”, x);
b . System.out.printf(“%.2f”, x);
Git is a
Version Control System
double x = 31;
int y = 10;
Which of these will print Happy Halloween 10/31
a. System.out.printf(“Happy Halloween %d/%f”, y, x);
b. System.out.printf(“Happy Halloween %f/%d”, y, x);
c. System.out.printf(“Happy Halloween %d/%.0f”, y, x);
d. System.out.printf(“Happy Halloween %.0d/%f”, y, x);
c. System.out.printf(“Happy Halloween %d/%.0f”, y, x);
What is the Git command git innit used for?
Initializes a local git repository
What is the Git command git commit used for?
Takes everything thats in the index/staging area and commits it to the local repository
Who created Git?
Linus Torvalds and the Linux community
What is version control?
The tracking and managing of changes to software code
What does the Git command git add <file> used for?</file>
Adds the selected files to the staging area of the index, ready not to be commit
What is the Git command git status used for?
Checks what you have in the index/staging area, shows the differences between the working tree and the staging area
What is the Git command git push used for?
Pushes the local repository you have created and pushes it to a remote repository
What is the Git command git pull used for?
Pull the latest version from a remote repository
What is the Git command git clone used for?
Clones the repository into a new directory
The java compiler translates a .java file to generate a _____ file (what file extension for the created file?)
.class file
What command line command, reports the version of the Java compiler installed?
javac -version
What command line command, reports the version of the Java Runtime Environment installed?
java -version
When working in Eclipse, to edit and compile code you use the _____.
Editor or Workbench
What is the default file extension for UMLet diagrams?
.UXF
What does this line of code do?
int value1 = Integer.parseInt(“42”);
42 is a string, parseInt(String) converts it into an int