Computer Programming 2


Introduction to Programming 2 teaches students to program using the Java programming language with the help of the Net Beans Integrated Development Environment. As an introduction, this course gives students an overview of the different components of the computer, different number systems and its conversions and Problem-solving strategies.

none of the choicesWhich of the following shows a valid Overloading method?
EncapsulationIt is the method of hiding certain elements of the implementation of a certain class?
1What is the return value of this method: int test(){return 1;} ?
35087When was the officially released of Java?
if (xWhich statement will check if x is less than y?
All of the choicesWhich of the following is a valid nexDouble() return value?
. Platform independentThe Java feature, "write once, run anywhere", is termed as
if (boolean_expression)Which of the following has the correct form for an if statement?
Runtime errors occur during run-time.Which of the following is true about Runtime errors:
short x=1; int y = x;Which of the following will do implicit cast?
testWhat is the name of this method: int test(){return 1;} ?
11What is the output of the code snippet below: void main(){test();test();} void test(){System.out.print(“1”);}
stringArray[5];Which of the following correctly accesses the sixth element stored in an array of 10 elements?
ClassWhat do you call a blueprint of an object?
java HelloWorldWhat is the correct statement to run Java program in command line?
None of the above"What will be the value of x after you execute this statement int z=0; for(int x=0; x<10 for="" int="" td="" x="" y="" z="">
To make JavaC available or accessible in command line.Why do we need to set the path for JavaC in command line?
StaticWhich of the following is not the feature of java?
The program will display an input dialog box that allows the user to input text and returns String value.What will happen if you use JOptionPane. showInputDialog statement in your program?
int x = 1;Which of the following is not a valid variable declaration in Java?
5What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
29What is the index number of the last element of an array with 30 elements?
void test(int x){} void test(double x){}Which of the following shows Overloading method?
ClassIt is a template for creating an object?
1.01What is the output of the code snippet below:
none of the choices or allWhich of the following is not a valid Float value?
nameWhich of the following is a valid identifier?
javaWhat is the extension name of a Java Source code?
Source CodeWhat is the input for Java Compiler?
1010Which of the following is a valid nextInt() return value?
All of the statements are correctWhat is floating-point literal?
C:\Program Files\Java\jdk1.6.0_23\binWhat is the correct statement to set JavaC path in command line?
AccessorIt used to read values from class variables?
String str = JOptionPane.showInputDialog("");Which of the following is a valid statement to accept String input?
TRUEWhat is the result if we execute this: “a”.equals(“a”);?
None of the choicesWhich of the following is a valid statement to accept int input? Let us assume that we have declared scan as Scanner.
public abstract class Person {}Which of the following class declaration is not allowed to be instantiated?
switchWhich is not a repetition control structure?
765321"What is the output of the code snippet below: int[] intArray = { 1, 2, 3, 5, 6, 7 }; for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}"
intWhat is the return type of this method: int test(){return 1;} ?
All of the choicesWhich of the following creates an instance of a class?
6What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
MultithreadedThe feature of Java which makes it possible to execute several tasks simultaneously.
nameWhich of the following is not a java keyword?
print "Hello World" infinitely"What will be the output if you execute this code? do{System.out.println(""Hello World!"");}while(true);"
. OakWhat was the initial name of the Java programming language?
It depends, if there is a compiler embedded in Notepad.Can we directly compile codes from notepad?
id_1Which of the following a valid Java identifier?
superWhich of the following is the correct way to call the constructor of the parent class?
5From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
None of the choicesWhich of the following we are not allowed to write java source code?
short x=1; int y = xWhich of the following will do implicit cast?
Declaration CommentsWhich of the following is not a Java comment?
4From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
TRUE"What will be the value of intResult or booleanResult if we execute the following expressions? booleanResult = !((a + c) > b) && x;"
None of the choicesWhich of the following is not usable for writing java source code?
19What is the index number of the last element of an array with 20 elements?
TRUE"What will be the value of intResult or booleanResult if we execute the following expressions? booleanResult = x && y || x;"
0"int[] intArray = new int[10]; for(int x = 0; x
All of the choicesWhich of the following declares an array of int named intArray?
PolymorphismIt is the ability of an object to have many forms?
TRUEWhat is the result if we execute this: “a” instanceof String; ?
public class Person implements [InterfaceName] {}Which of the following is the correct way to use an interface?
None of the choicesWhich is not a decision control structure?
The program will display message dialog box.What will happen if you use JOptionPane.showMessageDialog statement in your program?
print "Hello World""What will be the output if you execute this code? do{System.out.println(""Hello World!"");}while(false)"
voidWhat is the return value of this method: public void sum(){int x=1;} ?
OakWhat was the initial name for the Java programming language?
All of the choicesWhich of the following show casting object?
extendsWhat keyword is used to perform class inheritance?
None of the choicesWhich of the following is not Java Literal?
All of the statements are correcWhich of the following is true about Interface?
. int 25What will be the value of x if we execute this: String s = "25"; int x = Integer.parseInt(s); ?
"int a[] = new int[1]; System.out.println(a[1]);"What will be the output if you execute this code:
Class VariableWhat do you call a variable that belong to the whole class?
Yes, because we can call Java compiler from NetBeansCan we directly compile codes from NetBeans?
none of the choicesWhich statement will check if x is equal to y?
111111"void main(){test(“11”);test(“1”);} void test(String x){System.out.print(x + x);}"
nextLine()Which of the following method reads input from the user and return String value?
SubclassWhat do you call a class that inherits a class?
StringWhich of the following is not a primitive data type?
public final class Person {}Which of the following class declaration is not allowed to be inherited?
None of the choicesWhich of the following does not return numeric value?
public final void setName(){}Which of the following method is allowed to be overriden?
11What will be the value of x after executing this code
Interpreting bytecodeJVM is responsible for
Interpreting bytecodeWhat is the function of JVM?
All of the choicesWhich of the following is a valid multidimensional array?
public interface [InterfaceName] {}Which of the following is the correct way to define an interface?
Byte CodeWhat did java generates after compiling the java source code?
none of the choicesWhich of the following is not an escape sequence?
1"What will be the value of intResult or booleanResult if we execute the following expressions? intResult = 1;"
package ;Which of the following is the correct syntax to define a method?
StringWhat type of value does the nextLine() returns?
There will be a syntax error after compilation.What will happen if we compile the statement below? ~System.out.println(“Hello World!”)
3Which of the following is a valid nextByte() return value?
1.01"void main(){test(1.0); test(1);} void test(double x){ System.out.print(x); void test(int x){System.out.print(x);}"
javac HelloWorld.javaWhat is the correct statement to compile Java program in command line?
12What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
computeWhich of the following is a valid method name:
All of the statements are trueWhich of the following is true about syntax errors:
18intResult += c;
1intResult = b % a;
15intResult = ++b * a + c;
48intResult = b << c;
2intResult = a & b;
11intResult = a | b + c;
8intResult = a >> 2;
1intResult = 1;
TRUEbooleanResult = !((a + c) > b)   && x;
TRUEbooleanResult = x && y || x;
The correct answers are: C:\Program Files\Java\jdk1.6.0_23\bin, < JavaC directory >, All of the given choices are correctWhat is the correct statement to set JavaC path in command line?
float x = 2.0D;Which of the following is not a valid variable declaration in Java?
if (xWhich statement will check if x is less than y?
There will be a syntax error after compilation."What will happen if we compile the statement below? ~System.out.println(“Hello World!”)"
None of the aboveWhat will be the value of x after you execute this statement
Platform independentThe Java feature, "write once, run anywhere", is termed as
No, We can only write codes in NotepadCan we directly compile codes from notepad?
1995When was the officially released of Java?
none of the choicesWhich of the following is not a valid Float value?
print "Hello World" infinitelyWhat will be the output if you execute this code?
display 1111what will be the output if you execute this code?
print "Hello World"What will be the output if you execute this code? do{System.out.println("Hello World!");}while(true);
print "Hello World"
765321What is the output of the code snippet below:
0What is the output of the code snippet below:
1What is the return value of this method: ?
111111What is the output of the code snippet below:
voidWhat is the return value of this method: public void sum(){} ?
intWhat is the return type of this method: ?
testWhat is the name of this method: ?
The correct answers are: All of the choices, none of the choicesWhich of the following shows a valid Overloading method?
int 25What will be the value of if we execute this: ?
super()Which of the following is the correct way to call the constructor of the parent class?
All of the statements are correctWhich of the following is true about Interface?
None of the ChoiceWhat will be the value of x after you execute this statement
It will produce an exception.What will be the output if you execute this code:
5What is the maximum index of the array:
All of the choicesWhich of the following is a valid editor for java source code?
All of the above.Which of the following is true about syntax errors:
All of the choiceWhich of the following is a valid multidimensional array?
All of the choicesWhich of the following scenarios where an exception may occur?
3From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
All of the choicesWhat is floating-point literal?
TRUEWhat is the result if we execute this: ?
OakWhat was the initial name of the Java programming language?
Runtime errors occur during run-time.Which of the following is true about Runtime errors
All of the choicesWhich of the following is true about constructor?
thisIt is used to access the instance variables shadowed by the parameters.
display 111what will be the output if you execute this code?
all of the choicesWhich of the following is not a valid Float value?
package ;Which of the following is the correct syntax to define a method?
int num = scan.nextInt();Which of the following is a valid statement to accept int input? Let us assume that we have declared scan as Scanner.











Comments

Popular Posts