You are on page 1of 7

UGRD-ITE6104 Computer Programming 2

Source by: Macarilao, Jay

Can we directly compile codes from NetBeans? Yes, because we can call Java compiler from NetBeans

Which of the following is true about syntax errors: All of these

Can we directly compile codes from notepad? Yes, Because we can call Java compiler from notepad

What will happen if we compile the statement below? ~System.out.println(“Hello World!”) There will be
a syntax error after compilation.

What is the extension name of a Java Source code? java

Which of the following we are not allowed to write java source code? None of these

The Java feature, "write once, run anywhere", is termed as Platform independent

Which of the following is not the feature of java? Static

Which of the following is true about Runtime errors: Runtime errors occur during run-time.

What is the correct statement to run Java program in command line? java HelloWorld

Which of the following is not a Java comment? Declaration Comments

Which of the following is not a valid Float value? None of these

Which of the following is a valid identifier? name

Which of the following is not a primitive data type? String

Which of the following is not a valid variable declaration in Java? None of these

Which of the following is not an escape sequence? None of these

Which of the following is not Java Literal? None of the above

Which of the following is not a java keyword? name

Which of the following a valid Java identifier? All of these

What is floating-point literal? All of these


"What will be the value of intResult or
booleanResult if we execute the following
TRUE
expressions? booleanResult = !((a + c) > b) &&
x;"
"What will be the value of intResult or
1 booleanResult if we execute the following
expressions? intResult = 1;"
What will happen if you use
The program will display message dialog
JOptionPane.showMessageDialog statement in
box.
your program?
Which of the following is a valid nexDouble()
All of the choices
return value?
Which of the following method reads input from
nextLine()
the user and return String value?
Which of the following is a valid nextInt() return
1010
value?
Which of the following is a valid statement to
None of the choices accept int input? Let us assume that we have
declared scan as Scanner.
String What type of value does the nextLine() returns?
Which of the following is a valid nextByte() return
3
value?
The program will display an input dialog
What will happen if you use JOptionPane.
box that allows the user to input text and
showInputDialog statement in your program?
returns String value.
Which of the following does not return numeric
None of the choices
value?
String str = Which of the following is a valid statement to
JOptionPane.showInputDialog(""); accept String input?
"What will be the output if you execute this
print "Hello World" infinitely code? do{System.out.println(""Hello
World!"");}while(true);"
All of the statements are correct What is floating-point literal?
Which of the following is not usable for writing
None of the choices
java source code?
Which of the following is not a valid variable
 int x = 1;
declaration in Java?
"What will be the value of x after you execute
None of the above this statement int z=0; for(int x=0; x<10 for=""
int="" td="" x="" y="" z="">
name Which of the following is not a java keyword?
none of the choices Which statement will check if x is equal to y?
What is the correct statement to compile Java
 javac HelloWorld.java
program in command line?
What was the initial name for the Java
Oak
programming language?
Static Which of the following is not the feature of java?
if (x Which statement will check if x is less than y?
Interpreting bytecode JVM is responsible for
Which of the following is not an escape
none of the choices
sequence?
name Which of the following is a valid identifier?
Which of the following is true about syntax
All of the statements are true
errors:
Which of the following is a valid statement to
None of the choices accept int input? Let us assume that we have
declared scan as Scanner.
What did java generates after compiling the java
Byte Code
source code?
What is the correct statement to run Java
 java HelloWorld
program in command line?
There will be a syntax error after What will happen if we compile the statement
compilation. below? ~System.out.println(“Hello World!”)
The feature of Java which makes it possible to
Multithreaded
execute several tasks simultaneously.
String str = Which of the following is a valid statement to
JOptionPane.showInputDialog(""); accept String input?
Which of the following is true about Runtime
Runtime errors occur during run-time.
errors:
None of the choices Which of the following is not Java Literal?
"What will be the output if you execute this
print "Hello World" code? do{System.out.println(""Hello
World!"");}while(false)"
The Java feature, "write once, run anywhere", is
. Platform independent
termed as
Which of the following is a valid nexDouble()
All of the choices
return value?
Declaration Comments Which of the following is not a Java comment?
It depends, if there is a compiler
Can we directly compile codes from notepad?
embedded in Notepad.
none of the choices or all Which of the following is not a valid Float value?
What is the correct statement to set JavaC path
C:\Program Files\Java\jdk1.6.0_23\bin
in command line?
id_1 Which of the following a valid Java identifier?
Which of the following has the correct form for
if (boolean_expression)
an if statement?
None of the choices Which of the following we are not allowed to
write java source code?
Which of the following is not a primitive data
String
type?
What will happen if you use
The program will display message dialog
JOptionPane.showMessageDialog statement in
box.
your program?
What will be the value of x after executing this
11
code
None of the choices Which is not a decision control structure?
Source Code What is the input for Java Compiler?
switch Which is not a repetition control structure?
"What will be the value of intResult or
TRUE booleanResult if we execute the following
expressions? booleanResult = x && y || x;"
"What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 }; for(int x =
765321
intArray.length-1; x>=0; x--)
{System.out.print(intArray[x]);}"
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };,
5
what is the value of intArray[3]?
What is the maximum index of the array: int[]
5
intArray = { 1, 2, 3, 5, 6, 7 };
Which of the following correctly accesses the
stringArray[5];
sixth element stored in an array of 10 elements?
Which of the following is a valid multidimensional
All of the choices
array?
What is the length of the array: int[] intArray =
6
{ 1, 2, 3, 5, 6, 7 };
Which of the following correctly accesses the
stringArray[5];
sixth element stored in an array of 10 elements?
Which of the following declares an array of int
All of the choices
named intArray?
0 "int[] intArray = new int[10]; for(int x = 0; x
What is the index number of the last element of
29
an array with 30 elements?
compute Which of the following is a valid method name:
"void main(){test(“11”);test(“1”);} void test(String
111111
x){System.out.print(x + x);}"
What is the name of this method: int test(){return
test
1;} ?
Which of the following shows a valid Overloading
none of the choices
method?
void test(int x){} void test(double x){} Which of the following shows Overloading
method?
What is the return type of this method: int test()
int
{return 1;} ?
What is the return value of this method: int test()
1
{return 1;} ?
What is the return value of this method: public
void
void sum(){int x=1;} ?
Which of the following shows a valid Overloading
none of the choices
method?
What is the output of the code snippet below:
11 void main(){test();test();} void test()
{System.out.print(“1”);}
1.01 What is the output of the code snippet below:
What is the extension name of a Java Source
java
code?
What is the name of this method: int test(){return
test
1;} ?
Which of the following shows a valid Overloading
none of the choices
method?
What is the return value of this method: int test()
1
{return 1;} ?
What do you call a variable that belong to the
Class Variable
whole class?
Class What do you call a blueprint of an object?
What is the result if we execute this:
true
“a”.equals(“a”);?
It is the method of hiding certain elements of the
Encapsulation
implementation of a certain class?
All of the choices Which of the following show casting object?
Class It is a template for creating an object?
Which of the following creates an instance of a
All of the choices
class?
What will be the value of x if we execute this:
. int 25
String s = "25"; int x = Integer.parseInt(s); ?
What is the result if we execute this: “a”
true
instanceof String; ?
short x=1; int y = x; Which of the following will do implicit cast?
Polymorphism It is the ability of an object to have many forms?
Subclass What do you call a class that inherits a class?
All of the statements are correc Which of the following is true about Interface?
Which of the following is the correct way to
public interface [InterfaceName] {}
define an interface?
Which of the following method is allowed to be
public final void setName(){}
overriden?
Which of the following class declaration is not
public abstract class Person {}
allowed to be instantiated?
Which of the following is the correct way to call
super
the constructor of the parent class?
What keyword is used to perform class
extends
inheritance?
Which of the following class declaration is not
public final class Person {}
allowed to be inherited?
public class Person implements Which of the following is the correct way to use
[InterfaceName] {} an interface?
What is the index number of the last element of
19
an array with 20 elements?
Which of the following is the correct syntax to
package ;
define a method?
short x=1; int y = x; Which of the following will do implicit cast?
Interpreting bytecode What is the function of JVM?
What is the name of this method: int test(){return
test
1;} ?
"void main(){test(1.0); test(1);} void test(double
1.01 x){ System.out.print(x); void test(int x)
{System.out.print(x);}"
What will be the value of x after executing this
12
code for(int x=0; x<=11; x++) {} is run?
"int a[] = new int[1];
What will be the output if you execute this code:
System.out.println(a[1]);"
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };,
4
what is the value of intArray[2]?
Accessor It used to read values from class variables?
What was the initial name of the Java
. Oak
programming language?
What is the return value of this method: int test()
1
{return 1;} ?
Static Which of the following is not the feature of java?
35087 When was the officially released of Java?
Yes, because we can call Java compiler
Can we directly compile codes from NetBeans?
from NetBeans
short x=1; int y = x Which of the following will do implicit cast?
To make JavaC available or accessible in Why do we need to set the path for JavaC in
command line. command line?

You might also like