Question
1- Suppose, you just wrote (from scratch) a new Java SOURCE CODE for some program on your system. What do you (or your IDE, such
1- Suppose, you just wrote (from scratch) a new Java SOURCE CODE for some program on your system. What do you (or your IDE, such as Eclipse) need to RUN it?
Java compiler and Java Virtual Machine | ||
Just Java compiler | ||
Just Java Virtual Machine | ||
Java Debugger |
2- Which Java primitve data type will require the least amount of memory to store data in?
long | ||
boolean | ||
char | ||
float |
3-Which one would NOT be considered a LITERAL in Java?
true | ||
null | ||
Math.PI | ||
0.0 |
4- Consider the following Java class (source code):
public class NumberOne { public static void main(String[] args){ System.out.println("Hello CS 116 Students!"); } }
If you wanted to save it on your hard drive for later compilation, what should (as in: it is not a hard requirement, but it helps avoid confusion) its full file name be?
NumberOne.java | ||
NumberOne.class | ||
NumberOne | ||
numberone.java |
5- In Java the following expression:
float x = 0.1f;
will ...
declare and initialize a variable | ||
instantiate an object | ||
only initialize the variable | ||
only declare the variable |
6-Consider the following Java class (source code):
public class NumberOne { public static void main(String[] args){ System.out.println("Hello CS 116 Students!"); } }
If you compile it (turn source code into so called byte code), what will be the full COMPILED file name ?
NumberOne.class | ||
NumberOne.java | ||
NumberOne | ||
numberone.java |
7-Consider the following Java class (source code):
public class SomeClass { public static void methodName(String[] args){ System.out.println("Test!"); } }
Assume that this class is the ONLY class in your Java project (there are no other source code / class files and you are not using any built-in Java classes). Will you be able to RUN / EXECUTE your project / program to display 'Test!' on screen? yes or no?
8- Java compiler, when analyzing your source code, will ...
find ONLY semantic errors (syntax errors will not be found) | ||
find BOTH syntax and semantic errors | ||
find ONLY syntax errors (semantic errors will not be found) | ||
find NEITHER syntax nor semantic errors |
9- When declaring a variable in Java, which Java keyword is used to indicate that this variable will be treated as a CONSTANT (i.e. its value can only be set ONCE)?
static | ||
const | ||
final | ||
finally |
10- Which Java primitve data type will require the largest amount of memory to store data in?
char | ||
byte | ||
float | ||
boolean |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started