ITE6104 Computer Programming 2

ITE6104 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.



What is the correct statement to set JavaC path in command line?

-C:\Program Files\Java\jdk1.6.0_23\bin

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

-Platform independent

JVM is responsible for

-Interpreting bytecode

Which of the following is true about syntax errors:

-All of these

Which of the following is not the feature of java?

-Static

What did java generates after compiling the java source code?

-Byte Code

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

-None of these

-When was the officially released of Java?

-1995

Can we directly compile codes from notepad?

-It depends, if there is a compiler embedded in Notepad.

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

-None of these

What will happen if we compile the statement below? ~System.out.println(“Hello World!”)

-There will be a syntax error after compilation.

Can we directly compile codes from NetBeans?

-Yes, because we can call Java compiler from NetBeans

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

-java HelloWorld

The feature of Java which makes it possible to execute several tasks simultaneously.

-Multithreaded

What is the correct statement to compile Java program in command line?

-javac HelloWorld.java

What is the extension name of a Java Source code?

-java

What was the initial name for the Java programming language?

-Oak

Which of the following is true about Runtime errors:

-Runtime errors occur during run-time.

Why do we need to set the path for JavaC in command line?

-To make JavaC available or accessible in command line.

What is the input for Java Compiler?

-Source Code

Which of the following is not a primitive data type?

-String

Which of the following is not an escape sequence?

-None of these

What is floating-point literal?

-All of these

Which of the following is a valid identifier?

-name

Which of the following is not a valid Float value?

-None of these

Which of the following is not a Java comment?

-Documentation Comments

Which of the following is not a java keyword?

-name

Which of the following is not Java Literal?

-None of the above

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

-int x = 1;

Which of the following a valid Java identifier?

-id_1

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

-int x = 1;

Why do we need to set the path for JavaC in command line?

-To make JavaC available or accessible in command line.

What is floating-point literal?

-All of these

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

-Platform independent

What is the correct statement to set JavaC path in command line?

-C:\Program Files\Java\jdk1.6.0_23\bin

Which of the following is not a valid Float value?

-None of these

Which of the following is not the feature of java?

-Static

Which of the following is not Java Literal?

-None of the above

Which of the following a valid Java identifier?

-id_1

What did java generates after compiling the java source code?

-Byte Code

What was the initial name for the Java programming language?

-Oak

Which of the following is not a primitive data type?

-String

What is the extension name of a Java Source code?

-java

Can we directly compile codes from NetBeans?

-Yes, because we can call Java compiler from NetBeans

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

-None of these

Which of the following is true about syntax errors:

-All of these

Which of the following is not a java keyword?

-name

What will happen if we compile the statement below? ~System.out.println(“Hello World!”)

-There will be a syntax error after compilation

Which of the following is a valid identifier?

-name

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

-None of these

When was the officially released of Java?

-1995

The feature of Java which makes it possible to execute several tasks simultaneously

-Multithreaded

Can we directly compile codes from notepad?

-It depends, if there is a compiler embedded in Notepad.

Which of the following is true about Runtime errors:

-Runtime errors occur during run-time.

What is the correct statement to compile Java program in command line?

-java HelloWorld.java

JVM is responsible for

-Interpreting bytecode

What is the input for Java Compiler?

-Source Code

Which of the following is not a Java comment?

-Declaration Comments

Which of the following is not an escape sequence?

-None of these

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

-java HelloWorld

what will be the output if you execute this code?

int x=1;

switch(x){

case 1:

System.out.print(“1”); 

case 2: 

System.out.print(“1”); 

case 3: 

System.out.print(“1”); 

default: 

System.out.print(“1”); 

}

-display 1111

Which of the following is a valid nextInt() return value?

-1010

Which is not a decision control structure?

-None of these

What will be the output if you execute this code? do{System.out.println("Hello World!");}while(false);

-print "Hello World"

What will be the value of x after you execute this statement int z=0; for(int x=0; x);

-None of these

What will happen if you use JOptionPane.showMessageDialog statement in your program?

-The program will display message dialog box

What will be the value of x after executing this code for(int x=0; x<=10; x++) {} is run?

-The program will display message dialog box

What will be the value of x after executing this code for(int x=0; x<=10; x++) {} is run?

-11

Which of the following has the correct form for an if statement?

-if (boolean_expression)

Which is not a repetition control structure?

-switch

Which of the following is a valid nexDouble() return value?

-All of these

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]);}

-765321

Which of the following is a valid multidimensional array?

-All of these

Which of the following correctly accesses the sixth element stored in an array of 10 elements?

-stringArray[5];

Which of the following correctly accesses the sixth element stored in an array of 10 elements?

-stringArray[5];v

What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

-5

From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?

-5

Which of the following declares an array of int named intArray?

-All of these

What is the output of the code snippet below:

int[] intArray = new int[10]; 

for(int x = 0; x<intArray.lenght; x++){Systrm.out.print(intArray[x]);}

-0000000000

What is the index number of the last element of an array with 30 elements?

-29

What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

-6

What is the output of the code snippet below:

void main(){test(“11”);test(“1”);}

void test(String x){System.out.print(x + x);}


-111111

What type of value does the nextLine() returns?

-String


Which of the following correctly accesses the sixth element stored in an array of 10 elements?

-stringArray[5];


What is the output of the code snippet below:

void main(){

test(1.0);

test(1);}

void test(double x){

System.out.print(x); }

void test(int x){

System.out.print(x);}


-1.01


What is the return type of this method: int test(){return 1;} ?

-int


Which of the following is a valid method name:

-compute


What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

-5


Which of the following correctly accesses the sixth element stored in an array of 10 elements?

-stringArray[5];


Which of the following is a valid statement to accept String input?

-String str = JOptionPane.showInputDialog("");


What will be the value of x after you execute this statement 

int z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);

-None of these


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]);}

-765321


What will happen if you use JOptionPane. showInputDialog statement in your program?

-The program will display an input dialog box that allows the user to input text and returns String value


Which of the following shows a valid Overloading method?

-None of these


What is the output of the code snippet below: void main(){test();test();} void test(){System.out.print(“1”);}

-11


Which of the following is a valid statement to accept int input? Let us assume that we have declared scan as Scanner.

-None of these


Which is not a repetition control structure?

-switch


Which of the following is a valid nextInt() return value?

-1010


Which of the following is a valid nexDouble() return value?

-All of these


What is the index number of the last element of an array with 30 elements?

-29


What is the output of the code snippet below:

int[] intArray = new int[10];

for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}


-0000000000


Question text Which of the following does not return numeric value?

-None of these


What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };

-6


What is the return value of this method: int test(){return 1;} ?

-1


Which of the following method reads input from the user and return String value?

-nextLine()

Which statement will check if x is equal to y?

-None of these


What is the name of this method: int test(){return 1;} ?

-test


What will happen if you use JOptionPane.showMessageDialog statement in your program?

-The program will display message dialog box.


From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?

-5


What will be the output if you execute this code?

do{System.out.println("Hello World!");}while(true);

-print "Hello World"


Which of the following declares an array of int named intArray?

-All of these


Which of the following is a valid nextByte() return value?

-3


what will be the output if you execute this code?

int x=1;

switch(x){

case 1:

System.out.print(“1”);

case 2:

System.out.print(“1”);

case 3:

System.out.print(“1”);

default:

System.out.print(“1”);

}


-display 1111


Which statement will check if x is less than y?

-if (x<y);


What will be the value of x after executing this code

for(int x=0; x<=10; x++) {} is run?

-11


What will be the output if you execute this code?

do{System.out.println("Hello World!");}while(false);

-print "Hello World"


Which is not a decision control structure?

-None of these


Which of the following shows Overloading method?

-void test(int x){} void test(double x){}


Which of the following is a valid multidimensional array?

-All of these


What is the return value of this method: public void sum(){int x=1;} ?

-void