Simulador de preparacion exmen certificacion JAVA 7 developer

Description

se trata de hacer un examen para prepararse para el examen de certificacion de java
JUAN JOSÈ ORJUEL
Quiz by JUAN JOSÈ ORJUEL, updated more than 1 year ago
JUAN JOSÈ ORJUEL
Created by JUAN JOSÈ ORJUEL about 9 years ago
221
1

Resource summary

Question 1

Question
what are the valid components of a java source file (choose all that apply)
Answer
  • package statement
  • import statements
  • methods
  • variables
  • java compiler
  • java runtime environment

Question 2

Question
the following munbered list of java class components is not in any particular order. select the correct order of their occurrence in a java class (choose all that apply): 1. comments 2. import statements 3. package statement 4. methods 5. class declaration 6. variables.
Answer
  • 1,3,2,5,6,4
  • 3,1,2,5,4,6
  • 3,2,1,4,5,6
  • 3,2,1,5,6,4

Question 3

Question
which of the following examples define the correct java class structure

Question 4

Question
given the following definition of the class EjavaGuru, what is the output of the previous class, if it is executed using the command: "java EjavaGuru one two three four"
Answer
  • one:two:three
  • EJavaGuru:one:tow
  • java:EJavaGuru:one
  • tow:three:four

Question 5

Question
given the following contents of the java source code file MyClass.java select the correct options
Answer
  • the imported class, java.util.Date, can be accessed only in the class Student.
  • the imported class, java.util.Date, can be accessed by both the Student and Course classes
  • Both of the classes Student and Course are defined in the package com.ejavaguru.
  • Course is defined in the default java package.

Question 6

Question
which of the following options, when inserted at //INSERT CODE HERE will print out EJavaGuru
Answer
  • public void main (String [] args)
  • public void main (String args [] )
  • static public void main (String[] array)
  • public static void main (String args)
  • static public main (String args[])

Question 7

Question
select the correct options
Answer
  • you can start the execution of a java application through the main method
  • the java compiler calls and executes the main method
  • the java virtual machine calls and executes the main method
  • a class calls and executes the main method

Question 8

Question
A class Course is definided in a package com.ejavaguru. Given that the physical location of the corresponding class file is /mycode/com/ejavaguru/Course.class and execution takes place within the mycode directory, which of the following lines of code, when inserted //INSERT CODE HERE, will import the Course class into the class MyCourse
Answer
  • import mycode.com.ejavaguru.Course;
  • import com.ejavaguru.Course;
  • import mycode.com.ejavaguru;
  • import com.ejavaguru;
  • import mycode.com.ejavaguru.*;
  • import com.ejavaguru.*;

Question 9

Question
examine the following code: which of the following statements will be true if the variable courseName is defined as a private variable?
Answer
  • class EJavaGuru will print Java
  • class EJavaGuru will print null
  • class EJavaGuru will won't compile
  • class EJavaGuru will throw an exception at runtime

Question 10

Question
Given the following definition of the class Course: what's the output of the following code?
Answer
  • the class EJavaGuru will print java
  • the class EJavaGuru will print null
  • the class EJavaGuru will not compile
  • the class EJavaGuru will throw an exception at runtime

Question 11

Question
Given the following code, select the correct options
Answer
  • you can't define a method argument as a private variable
  • a method argument should be defined with either public or default accessibility
  • for overridden methods, method arguments should be defined with protected accessibility.
  • none of the above

Question 12

Question
Select all incorrect statements
Answer
  • a programmer can't define a new primitive data type
  • a programmer can define a new primitive data type
  • once assigned, the value of a primitive can't be modified
  • a value can't be assigned to a primitive variable

Question 13

Question
which of the options are correct for the following code?
Answer
  • code at line 4 fails to compile
  • code at line 5 fails to compile
  • code at line 6 fails to compile
  • code at line 7 fails to compile

Question 14

Question
what is the output of the following code?
Answer
  • 611
  • 641
  • 930
  • 960

Question 15

Question
Select the options that is / are the best choice for de following
Answer
  • long, boolean, double
  • long, int, float
  • char, int, double
  • long, boolean, float

Question 16

Question
which of the following options contain correct code to declare and initialize variables to store numbers?
Answer
  • bit a = 0;
  • integer a2 = 7;
  • long a3 =0X10C;
  • short a4 = 0512;
  • double a5 = 10;
  • byte a7 = -0;
  • long a8 = 123456789;

Question 17

Question
Select the options that, when inserted at //INSERTE CODE HERE, will make the following code output code a value of 11
Answer
  • ctr +=1;
  • ctr =+1;
  • ++ctr;
  • ctr = 1;

Question 18

Question
what is the output of the following code
Answer
  • 218
  • 232
  • 246
  • compilation error

Question 19

Question
what is true about the following lines of code
Answer
  • code prints true
  • code prints false
  • code prints >= false
  • compilation error

Question 20

Question
which of the following methods correctly accepts three whole numbers as methods arguments and returns their sum as a decimal number?

Question 21

Question
how can you include encapsulation in your class design
Answer
  • define instance variables as private members
  • define public methods to access and modify the instance variables
  • define some of the instance variables as public members
  • all of the previous

Question 22

Question
if the functionality of the operators = and > were to be swapped in java (for the code on line number 4, 5, and 6), what would be the result of the following code?
Answer
  • true, true, false
  • 10.0, false, false
  • false, false, false
  • compilation error

Question 23

Question
examine the following code and select the correct options
Answer

Question 24

Question
examine the following code and select the correct options
Answer
  • the heigth de a Person can never be set to more than 300.
  • the previous code is an example of a well-encapsulated class
  • the class would be better encapsulated if the heigth validation weren't set to 300.
  • even though the class isn't well encapsulated, it can be inherited by other classes

Question 25

Question
which of the following correctly accepts three whole numbers as method arguments and returns their sum as a decimal number?

Question 26

Question
which of the following statements are true?
Answer
  • if the return type of a method is int, the method can return a value od type byte
  • a method may or may not return a value
  • if the return type of a method is void, it can define a return statement without a value, as follows: "return;"
  • a method may or may not accept any method arguments.
  • a method should accept at least one method argument or define its return type.
  • a method whose return type is String can't return null

Question 27

Question
Given the following definition of class Person,
Answer
  • anotherMethod, anotherMethod, someMethod, someMethod
  • anotherMethod, EJava, someMethod, someMethod
  • anotherMethod, EJava, someMethod, EJava
  • Compilation error.

Question 28

Question
what is the ouput of the following code?
Answer
  • 20 10 11 11
  • 20 20 11 10
  • 20 10 11 10
  • compilation error

Question 29

Question
Given the following signature of method eJava, choose the options that correctly overload this method
Answer
  • private String eJava(int val, String firstName, double dur)
  • public void eJava(int val1, String val2, double val3)
  • String eJava(int name , String age, double duration)
  • float eJava(double name, String age, byte duration)
  • ArrayList<String> eJava()
  • char[] eJava(double numbers)
  • String eJava()

Question 30

Question
given the following code,
Answer
  • Compilation error
  • Rintime exception
  • int String
  • long Object

Question 31

Question
examine the following code and select the correct options:
Answer
  • The class EJava defines three overloaded contructors
  • The class Ejava define two overloaded contructors. The private constructor isn't counted as an overloaded constructor.
  • Constructors with different access modifiers can't call each other
  • the code prints the following: protected private public
  • the code prints the following: public private protected

Question 32

Question
Select the incorrect options
Answer
  • If a user defines a private constructor for a public class, Java creates a public default constructor for the class.
  • A class that gets a default constructor doesn’t have overloaded constructors.
  • A user can overload the default constructor of a class.
  • The following class is eligible for default constructor: class EJava {}
  • The following class is also eligible for a default constructor: class EJava { void EJava() {} }

Question 33

Question
What is the output of the following code?
Answer
  • 4c010
  • 4c10
  • 113
  • 103
  • Compilation error

Question 34

Question
What is the output of the following code?
Answer
  • 0:0
  • a:b
  • 0:b
  • a:0
  • compilation error

Question 35

Question
Which of the following are valid lines of code to define a multidimensional int array?
Answer
  • int[][] array1 = {{1, 2, 3}, {}, {1, 2,3, 4, 5}};
  • int[][] array2 = new array() {{1, 2, 3}, {}, {1, 2,3, 4, 5}};
  • int[][] array3 = {1, 2, 3}, {0}, {1, 2,3, 4, 5};
  • int[][] array5 = new int[2][];

Question 36

Question
Which of the following statements are correct?
Answer
  • By default, an ArrayList creates an array with an initial size of 16 to store its elements.
  • Because ArrayList stores only objects, you can’t pass element of an ArrayList to a switch construct.
  • Calling clear() or remove() on an ArrayList, will remove all its elements.
  • If you frequently add elements to an ArrayList, specifying a larger capacity will improve the code efficiency.
  • Calling the method clone() on an ArrayList creates its shallow copy; that is, it doesn’t clone the individual list elements.

Question 37

Question
Which of the following statements are correct?
Answer
  • An ArrayList offers a resizable array, which is easily managed using the methods it provides. You can add and remove elements from an ArrayList.
  • Values stored by an ArrayList can be modified.
  • You can iterate through elements of an ArrayList using a for loop, Iterator, or ListIterator.
  • An ArrayList requires you to specify the total elements before you can store any elements in it.
  • An ArrayList can store any type of object.

Question 38

Question
What is the output of the following code?
Answer
  • Line 7 prints true
  • Line 7 prints false
  • Line 8 prints -1
  • Line 8 prints 1
  • Line 9 removes all elements of the list ejg
  • Line 9 sets ejg to null
  • Line 10 prints null
  • Line 10 prints []
  • Line 10 prints a value similar to ArrayList@16356
  • Line 11 throws an exception

Question 39

Question
What is the output of the following code?
Answer
  • true printed once
  • false printed once
  • true printed in an infinite loop
  • false printed in an infinite loop

Question 40

Question
What is the output of the following code?
Answer
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Question 41

Question
What is the output of the following code?
Answer
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Question 42

Question
What is the output of the following code?
Answer
  • 12S512S5
  • 12S12S
  • 1025102S
  • dRuntime exception

Question 43

Question
What is the output of the following code?
Answer
  • 521
  • Runtime exception
  • 65321
  • 65431

Question 44

Question
What’s the output of the following code?
Answer
  • 10
  • 30
  • 31
  • 32

Question 45

Question
What’s the output of the following code?
Answer
  • 10
  • 30
  • 31
  • 32

Question 46

Question
Which of the following statements is true?
Answer
  • The enhanced for loop can’t be used within a regular for loop.
  • The enhanced for loop can’t be used within a while loop.
  • The enhanced for loop can be used within a do-while loop.
  • The enhanced for loop can’t be used within a switch construct.
  • All of the above statements are false.

Question 47

Question
What’s the output of the following code?
Answer
  • true false ABC
  • false ABC
  • true ABC
  • Compilation error

Question 48

Question
Given the following code, which of the following lines of code can individually replace the //INSERT CODE HERE line so that the code compiles successfully?
Answer
  • case 10*3: System.out.println(2);
  • case num: System.out.println(3);
  • case 10/3: System.out.println(4);
  • case num2: System.out.println(5);

Question 49

Question
What’s the output of the following code?
Answer
  • default
  • default 4
  • 4
  • Compilation error

Question 50

Question
What’s the output of the following code?
Answer
  • default case1 case2
  • case1 case2
  • case2
  • Compilation error
  • Runtime exception

Question 51

Question
What’s the output of the following code?
Answer
  • ejava enum guru
  • ejava
  • ejavaguru e
  • ejava enum guru ejavaguru

Question 52

Question
What’s the output of the following code?
Answer
  • else
  • 0 1 2
  • 0 1
  • Compilation error

Question 53

Question
What’s the output of the following code?
Answer
  • Compilation error
  • 0 5
  • 0 5 10
  • 10
  • 0 1 5
  • 5
Show full summary Hide full summary

Similar

Simulador de Historia del Arte
Viktor Garcia
PROGRAMACIÓN ORIENTADA A OBJETOS - TERCER CORTE
Jose Anacona Pira
Acuerdo 8 Comité Directivo del Sistema Nacional de Bachillerato
Clases En Web
EVENTOS EN JAVA
**CR 7**
Parcial Fundamento de Programación
ALBERTO MANUEL PATERNINA LEON
Fundamentos de AdWords 2
Juan Antonio Gonzalez Lombana
Publicidad de Display 1
Juan Antonio Gonzalez Lombana
Publicidad en Búsquedas 2
Juan Antonio Gonzalez Lombana
Publicidad de Video
Juan Antonio Gonzalez Lombana
Publicidad en Búsquedas 1
Juan Antonio Gonzalez Lombana