Your browser does not support JavaScript!

Computer Programming 2

Showing 1-75 of 146 answers

__________ is implemented in at least two classes with inheritance relationship.  
  • Inheritance
  • None of the options
  • Overriding Correct
  • Polymorphism
  • Overloading
Can we directly compile codes from NetBeans?
  • It depends, if there is a compiler embedded in NetBeans
  • No, we can only write codes in NetBeans
  • Yes, because we can call Java compiler from NetBeans Correct
  • Both A and C are correct
Can we directly compile codes from notepad?
  • Yes, Because we can call Java compiler from notepad
  • It depends, if there is a compiler embedded in Notepad
  • Both A and C are correct
  • No, We can only write codes in Notepad Correct
Declare a two-dimensional integer array named values of size 6 columns and 4 rows.
  • int[ ][ ] values=new int[4][6]; Correct
  • int[ 6][4 ] values=new int;
  • int values=new int[6][4];
  • int[ ][ ] values=new int[6][4];
  • None of the above
Declare and initialize a double data type array named numbers with the following values: 23.35, 34.45, 56.77.
  • double[ ] numbers={2335, 3445, 5677}; Correct
  • double[ ] numbers={"2335, 3445, 5677"};
  • None of the choices
  • double[3] numbers={2335, 3445, 5677};
  • Double[ ] number={2335, 3445, 5677};
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
  • 3 Correct
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
  • 5 Correct
How many elements could be assigned to an array location with 5 columns and 3 rows?
  • 5
  • 15 Correct
  • 8
  • 3
  • None of the choices
It is a template for creating an object?
  • None of the above
  • Object Oriented
  • Method
  • Class Correct
  • Encapsulation
It is the ability of an object to have many forms?
  • Abstraction
  • Polymorphism Correct
  • Inheritance
  • Interface
  • None of the above
It is the method of hiding certain elements of the implementation of a certain class?
  • Encapsulation Correct
  • Class
  • Object
  • None of the above
  • Object Oriented
It is used to access the instance variables shadowed by the parameters.
  • this Correct
It used to read values from class variables?
  • Accessor Correct
JVM is responsible for
  • Generating bytecode
  • None of the Above
  • Compiling source code
  • Interpreting bytecode Correct
  • Reading bytecode
Multiple-Choice. Please select the best answer for the question. What will be the result if you execute this expression x=true ? 1 : 0;?
  • 1 Correct
  • 0
  • false
  • true
  • none of the above
Multiple-Choice. Please select the best answer for the question.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);?
  • 236
  • 128
  • 512
  • None of the above Correct
  • 1
Multiple-Choice. Please select the best answer for the question.Which is not a decision control structure?
  • switch
  • if else-if else
  • if else
  • None of the above Correct
  • if
Multiple-Choice. Please select the best answer for the question.Which is not a repetition control structure?
  • loop Correct
  • None of the above
  • do-while
  • for
  • while
Multiple-Choice. Please select the best answer for the question.Which of the following a valid Java identifier?
  • $id
  • id
  • id_1 Correct
  • all of the above
  • _id
Multiple-Choice. Please select the best answer for the question.Which of the following has the correct form for an if statement?
  • none of the above
  • if boolean_expression
  • if { boolean_expression }
  • boolean_expression
  • if (boolean_expression) Correct
Multiple-Choice. Please select the best answer for the question.Which of the following is not a Java Literal?
  • Boolean value
  • Integer value
  • None of the above Correct
  • Float value
  • Character value
Multiple-Choice. Please select the best answer for the question.Which of the following is not a primitive data type?
  • none of the above
  • int
  • byte
  • String Correct
  • double
Multiple-Choice. Please select the best answer for the question.Which statement will check if x is less than y?
  • if (x>y)?:
  • if (x<=y)
  • if (x<y); Correct
  • none of the above
  • if (x>y)
Since Java uses a virtual machine, what does that mean about the versatility of Java?
  • None of the Above
  • It can run most anywhere without modification Correct
  • Code Security
  • It is used almost exclusively on Intel platforms
  • It will run on Windows, Linux, Unix, but not Apple
The __________ keyword allocates memory for the array being declared.
  • new Correct
  • array
  • int
  • intArray
  • None of the above
The feature of Java which makes it possible to execute several tasks simultaneously.
  • Multithreaded Correct
The Java feature, "write once, run anywhere", is termed as
  • Object Oriented
  • None of the Above
  • Platform independent Correct
  • High Performance
  • Robust
The length of an array is established when the array is created at __________.
  • None of the above
  • runtime Correct
  • initialization
  • compile time
  • declaration
True or False. Please select the best answer for the question.byte, short, int, and for are one of Java's Primitive data types.
  • True
  • False Correct
True or False. Please select the best answer for the question.float is one of Java's Primitive data types
  • True Correct
  • False
True or False. Please select the best answer for the question.for, while and do-while is part of Java's Repetition Control Structures
  • True Correct
  • False
True or False. Please select the best answer for the question.Java is a simple, object-oriented, portable and robust computer language.
  • True Correct
  • False
True or False. Please select the best answer for the question.Java is architecture neutral
  • True Correct
  • False
True or False. Please select the best answer for the question.Java is secured
  • True Correct
  • False
True or False. Please select the best answer for the question.Java SE is a Java Platform
  • True Correct
  • False
True or False. Please select the best answer for the question.Java's control structures are branching, decision, and multithreaded.
  • True
  • False Correct
True or False. Please select the best answer for the question.Portable is one of Java's control structures
  • True
  • False Correct
True or False. Please select the best answer for the question.Repetition is one of Java's control structures
  • True Correct
  • False
Use the __________ statement when traversing through arrays.
  • whilewhile loop
  • switch
  • do-while loop
  • for loop Correct
  • none of the choices
What did java generates after compiling the java source code?
  • Byte Code Correct
What do you call a blueprint of an object?
  • Object
  • None of the above
  • Class Correct
  • Constructor
  • Method
What do you call a class that inherits a class?
  • Parent class
  • Class
  • Superclass
  • Subclass Correct
  • None of the above
What do you call a variable that belong to the whole class?
  • None of the above
  • Class Variable Correct
  • Class Method
  • Static Variable
  • Object Variable
What does Java generate after compiling the java source code?
  • Class Code
  • Image file
  • Executable file
  • None of the Above
  • Byte Code Correct
What is floating-point literal?
  • Can be express in scientific notation
  • All of the above Correct
  • An integer literal with decimal point
  • By default it is double type
  • It could be double or float value
What is the correct statement to compile Java program in command line?
  • javac HelloWorld
  • java HelloWorldjava
  • javac HelloWorldjava Correct
  • java HelloWorld
What is the correct statement to run Java program in command line?
  • None of the Above
  • java HelloWorld Correct
  • javac HelloWorldjava
  • java HelloWorldjava
  • javac HelloWorld
What is the correct statement to set javac path in command line?
  • None of the Above
  • set path=C:\Program Files\Java
  • All of the above
  • javac
  • set path
  • C:\Program Files\Java\jdk160_23\bin
  • path=C:\Program Files\Java\jdk160_23\bin Correct
What is the extension name of a Java Source code?
  • j
  • None of the Above
  • java Correct
  • class
  • javac
What is the index number of the last element of an array with 20 elements?
  • 19 Correct
What is the index number of the last element of an array with 30 elements?
  • 29 Correct
What is the input for Java Compiler?
  • Code
  • Byte Code
  • Native Code
  • Source Code Correct
  • None of the Above
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
  • 6 Correct
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
  • 5 Correct
What is the name of this method: int test(){return 1;} ?
  • 7
  • None of the choices
  • int
  • 6
  • test Correct
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 Correct
  • 12356
  • 123567
  • The given code is not valid
  • none of the choices
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 Correct
  • 012356789
  • The given code is not valid
  • 1235678910
  • none of the choices
What is the output of the code snippet below:            void main(){test("11");test("1");}            void test(String x){System.out.print(x + x);}
  • 222
  • 111111 Correct
  • 6
  • None of the choices
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 Correct
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 Correct
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 Correct
What is the output of the code snippet below: void main(){test();test();} void test(){System.out.print("1");}
  • 2
  • 11 Correct
  • 3
  • 1
  • None of the choices
What is the output of the code snippet below: void main(){test();test();} void test(){System.out.print(“1”);}
  • 11 Correct
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 Correct
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);}
  • 1010
  • None of the choices
  • 11
  • 10
  • 101 Correct
What is the result if we execute this: "a" instanceof String; ?
  • The code is not valid
  • false
  • true Correct
  • =E2=80=9Ca=E2=80=9D
  • None of the above
What is the result if we execute this: "a".equals("a");?
  • false
  • =E2=80=9Ca=E2=80=9D
  • true Correct
  • None of the above
  • The code is not valid
What is the result if we execute this: “a” instanceof String; ?
  • true Correct
What is the result if we execute this: “a”.equals(“a”);?
  • true Correct
What is the return type of this method: int test(){return 1;} ?
  • test()
  • 1
  • None of the above
  • void
  • int Correct
What is the return value of this method: int test(){return 1;} ?
  • test
  • All of the choices
  • int
  • return 1
  • 1 Correct
What is the return value of this method: public void sum(){int x=1;} ?
  • 1
  • sum
  • none of the choices
  • void Correct
  • x
What keyword is used to perform class inheritance?
  • extends Correct
  • derives
  • inherits
  • implements
  • None of the above
What type of value does the nextLine() returns?
  • None of the above
  • Line
  • double
  • String Correct
  • long
What was the initial name for the Java programming language?
  • Oak Correct
All courses