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 choices Which of the following shows a valid Overloading method?
Encapsulation It is the method of hiding certain elements of the implementation of a certain class?
1 What is the return value of this method: int test(){return 1;} ?
35087 When was the officially released of Java?
if (x Which statement will check if x is less than y?
All of the choices Which of the following is a valid nexDouble() return value?
. Platform independent The 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?
test What is the name of this method: int test(){return 1;} ?
11 What 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?
Class What do you call a blueprint of an object?
java HelloWorld What 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?
Static Which 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?
5 What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
29 What 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?
Class It is a template for creating an object?
1.01 What is the output of the code snippet below:
none of the choices or all Which of the following is not a valid Float value?
name Which of the following is a valid identifier?
java What is the extension name of a Java Source code?
Source Code What is the input for Java Compiler?
1010 Which of the following is a valid nextInt() return value?
All of the statements are correct What is floating-point literal?
C:\Program Files\Java\jdk1.6.0_23\bin What is the correct statement to set JavaC path in command line?
Accessor It used to read values from class variables?
String str = JOptionPane.showInputDialog(""); Which of the following is a valid statement to accept String input?
TRUE What is the result if we execute this: “a”.equals(“a”);?
None of the choices Which 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?
switch Which 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]);}
int What is the return type of this method: int test(){return 1;} ?
All of the choices Which of the following creates an instance of a class?
6 What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Multithreaded The feature of Java which makes it possible to execute several tasks simultaneously.
name Which 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);
. Oak What 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_1 Which of the following a valid Java identifier?
super Which of the following is the correct way to call the constructor of the parent class?
5 From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
None of the choices Which of the following we are not allowed to write java source code?
short x=1; int y = x Which of the following will do implicit cast?
Declaration Comments Which of the following is not a Java comment?
4 From 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 choices Which of the following is not usable for writing java source code?
19 What 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 choices Which of the following declares an array of int named intArray?
Polymorphism It is the ability of an object to have many forms?
TRUE What 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 choices Which 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)
void What is the return value of this method: public void sum(){int x=1;} ?
Oak What was the initial name for the Java programming language?
All of the choices Which of the following show casting object?
extends What keyword is used to perform class inheritance?
None of the choices Which of the following is not Java Literal?
All of the statements are correc Which of the following is true about Interface?
. int 25 What 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 Variable What do you call a variable that belong to the whole class?
Yes, because we can call Java compiler from NetBeans Can we directly compile codes from NetBeans?
none of the choices Which 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?
Subclass What do you call a class that inherits a class?
String Which 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 choices Which of the following does not return numeric value?
public final void setName(){} Which of the following method is allowed to be overriden?
11 What will be the value of x after executing this code
Interpreting bytecode JVM is responsible for
Interpreting bytecode What is the function of JVM?
All of the choices Which of the following is a valid multidimensional array?
public interface [InterfaceName] {} Which of the following is the correct way to define an interface?
Byte Code What did java generates after compiling the java source code?
none of the choices Which 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?
String What 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!”)
3 Which 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.java What is the correct statement to compile Java program in command line?
12 What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
compute Which of the following is a valid method name:
All of the statements are true Which of the following is true about syntax errors:
18 intResult += c;
1 intResult = b % a;
15 intResult = ++b * a + c;
48 intResult = b << c;
2 intResult = a & b;
11 intResult = a | b + c;
8 intResult = a >> 2;
1 intResult = 1;
TRUE booleanResult = !((a + c) > b)   && x;
TRUE booleanResult = x && y || x;
C:\Program Files\Java\jdk1.6.0_23\bin, < JavaC directory >, All of the given choices are correct What 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 (x Which 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 above What will be the value of x after you execute this statement
Platform independent The Java feature, "write once, run anywhere", is termed as
No, We can only write codes in Notepad Can we directly compile codes from notepad?
1995 When was the officially released of Java?
none of the choices Which of the following is not a valid Float value?
print "Hello World" infinitely What will be the output if you execute this code?
display 1111 what 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);"
765321 What is the output of the code snippet below:
0 What is the output of the code snippet below:
1 What is the return value of this method: ?
111111 What is the output of the code snippet below:
void What is the return value of this method: public void sum(){} ?
int What is the return type of this method: ?
test What is the name of this method: ?
All of the choices, none of the choices Which of the following shows a valid Overloading method?
int 25 What 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 correct Which of the following is true about Interface?
None of the Choice What 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:
5 What is the maximum index of the array:
All of the choices Which 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 choice Which of the following is a valid multidimensional array?
All of the choices Which of the following scenarios where an exception may occur?
3 From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
All of the choices What is floating-point literal?
TRUE What is the result if we execute this: ?
Oak What 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 choices Which of the following is true about constructor?
this It is used to access the instance variables shadowed by the parameters.
display 111 what will be the output if you execute this code?
all of the choices Which 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.
All of these Which of the following is a valid multidimensional array?
All of these Which of the following declares an array of int named intArray?
None of these Which of the following shows a valid Overloading method?

What do you think of this blog? Write down at the COMMENT section below.

2 comments:

Anonymous said...

thanjs!

Prince Abdullah said...

What is programming?
There are countless definitions of what computer programming is, but here is mine.
“Programming is how you get computers to solve problems.”
There are two key phrases here that are important:
• You: without the programmer (you), the computer is useless. It does what you tell it to do.
• Solve problems: computers are tools. They are complex tools, admittedly, but they are not mysterious or magical: they exist to make tasks easier.
To more read follow this link:
https://www.futurelearn.com/info/courses/programming-101/0/steps/43783