Simulador de preparacion exmen certificacion JAVA 7 developer

Beschreibung

se trata de hacer un examen para prepararse para el examen de certificacion de java
JUAN JOSÈ ORJUEL
Quiz von JUAN JOSÈ ORJUEL, aktualisiert more than 1 year ago
JUAN JOSÈ ORJUEL
Erstellt von JUAN JOSÈ ORJUEL vor etwa 9 Jahre
221
1

Zusammenfassung der Ressource

Frage 1

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

Frage 2

Frage
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.
Antworten
  • 1,3,2,5,6,4
  • 3,1,2,5,4,6
  • 3,2,1,4,5,6
  • 3,2,1,5,6,4

Frage 3

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

Frage 4

Frage
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"
Antworten
  • one:two:three
  • EJavaGuru:one:tow
  • java:EJavaGuru:one
  • tow:three:four

Frage 5

Frage
given the following contents of the java source code file MyClass.java select the correct options
Antworten
  • 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.

Frage 6

Frage
which of the following options, when inserted at //INSERT CODE HERE will print out EJavaGuru
Antworten
  • 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[])

Frage 7

Frage
select the correct options
Antworten
  • 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

Frage 8

Frage
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
Antworten
  • import mycode.com.ejavaguru.Course;
  • import com.ejavaguru.Course;
  • import mycode.com.ejavaguru;
  • import com.ejavaguru;
  • import mycode.com.ejavaguru.*;
  • import com.ejavaguru.*;

Frage 9

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

Frage 10

Frage
Given the following definition of the class Course: what's the output of the following code?
Antworten
  • 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

Frage 11

Frage
Given the following code, select the correct options
Antworten
  • 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

Frage 12

Frage
Select all incorrect statements
Antworten
  • 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

Frage 13

Frage
which of the options are correct for the following code?
Antworten
  • 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

Frage 14

Frage
what is the output of the following code?
Antworten
  • 611
  • 641
  • 930
  • 960

Frage 15

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

Frage 16

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

Frage 17

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

Frage 18

Frage
what is the output of the following code
Antworten
  • 218
  • 232
  • 246
  • compilation error

Frage 19

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

Frage 20

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

Frage 21

Frage
how can you include encapsulation in your class design
Antworten
  • 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

Frage 22

Frage
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?
Antworten
  • true, true, false
  • 10.0, false, false
  • false, false, false
  • compilation error

Frage 23

Frage
examine the following code and select the correct options
Antworten

Frage 24

Frage
examine the following code and select the correct options
Antworten
  • 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

Frage 25

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

Frage 26

Frage
which of the following statements are true?
Antworten
  • 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

Frage 27

Frage
Given the following definition of class Person,
Antworten
  • anotherMethod, anotherMethod, someMethod, someMethod
  • anotherMethod, EJava, someMethod, someMethod
  • anotherMethod, EJava, someMethod, EJava
  • Compilation error.

Frage 28

Frage
what is the ouput of the following code?
Antworten
  • 20 10 11 11
  • 20 20 11 10
  • 20 10 11 10
  • compilation error

Frage 29

Frage
Given the following signature of method eJava, choose the options that correctly overload this method
Antworten
  • 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()

Frage 30

Frage
given the following code,
Antworten
  • Compilation error
  • Rintime exception
  • int String
  • long Object

Frage 31

Frage
examine the following code and select the correct options:
Antworten
  • 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

Frage 32

Frage
Select the incorrect options
Antworten
  • 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() {} }

Frage 33

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

Frage 34

Frage
What is the output of the following code?
Antworten
  • 0:0
  • a:b
  • 0:b
  • a:0
  • compilation error

Frage 35

Frage
Which of the following are valid lines of code to define a multidimensional int array?
Antworten
  • 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][];

Frage 36

Frage
Which of the following statements are correct?
Antworten
  • 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.

Frage 37

Frage
Which of the following statements are correct?
Antworten
  • 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.

Frage 38

Frage
What is the output of the following code?
Antworten
  • 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

Frage 39

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

Frage 40

Frage
What is the output of the following code?
Antworten
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Frage 41

Frage
What is the output of the following code?
Antworten
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Frage 42

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

Frage 43

Frage
What is the output of the following code?
Antworten
  • 521
  • Runtime exception
  • 65321
  • 65431

Frage 44

Frage
What’s the output of the following code?
Antworten
  • 10
  • 30
  • 31
  • 32

Frage 45

Frage
What’s the output of the following code?
Antworten
  • 10
  • 30
  • 31
  • 32

Frage 46

Frage
Which of the following statements is true?
Antworten
  • 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.

Frage 47

Frage
What’s the output of the following code?
Antworten
  • true false ABC
  • false ABC
  • true ABC
  • Compilation error

Frage 48

Frage
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?
Antworten
  • 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);

Frage 49

Frage
What’s the output of the following code?
Antworten
  • default
  • default 4
  • 4
  • Compilation error

Frage 50

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

Frage 51

Frage
What’s the output of the following code?
Antworten
  • ejava enum guru
  • ejava
  • ejavaguru e
  • ejava enum guru ejavaguru

Frage 52

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

Frage 53

Frage
What’s the output of the following code?
Antworten
  • Compilation error
  • 0 5
  • 0 5 10
  • 10
  • 0 1 5
  • 5
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

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