Simulador de preparacion exmen certificacion JAVA 7 developer

Descrição

se trata de hacer un examen para prepararse para el examen de certificacion de java
JUAN JOSÈ ORJUEL
Quiz por JUAN JOSÈ ORJUEL, atualizado more than 1 year ago
JUAN JOSÈ ORJUEL
Criado por JUAN JOSÈ ORJUEL mais de 9 anos atrás
231
1

Resumo de Recurso

Questão 1

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

Questão 2

Questão
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.
Responda
  • 1,3,2,5,6,4
  • 3,1,2,5,4,6
  • 3,2,1,4,5,6
  • 3,2,1,5,6,4

Questão 3

Questão
which of the following examples define the correct java class structure

Questão 4

Questão
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"
Responda
  • one:two:three
  • EJavaGuru:one:tow
  • java:EJavaGuru:one
  • tow:three:four

Questão 5

Questão
given the following contents of the java source code file MyClass.java select the correct options
Responda
  • 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.

Questão 6

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

Questão 7

Questão
select the correct options
Responda
  • 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

Questão 8

Questão
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
Responda
  • import mycode.com.ejavaguru.Course;
  • import com.ejavaguru.Course;
  • import mycode.com.ejavaguru;
  • import com.ejavaguru;
  • import mycode.com.ejavaguru.*;
  • import com.ejavaguru.*;

Questão 9

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

Questão 10

Questão
Given the following definition of the class Course: what's the output of the following code?
Responda
  • 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

Questão 11

Questão
Given the following code, select the correct options
Responda
  • 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

Questão 12

Questão
Select all incorrect statements
Responda
  • 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

Questão 13

Questão
which of the options are correct for the following code?
Responda
  • 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

Questão 14

Questão
what is the output of the following code?
Responda
  • 611
  • 641
  • 930
  • 960

Questão 15

Questão
Select the options that is / are the best choice for de following
Responda
  • long, boolean, double
  • long, int, float
  • char, int, double
  • long, boolean, float

Questão 16

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

Questão 17

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

Questão 18

Questão
what is the output of the following code
Responda
  • 218
  • 232
  • 246
  • compilation error

Questão 19

Questão
what is true about the following lines of code
Responda
  • code prints true
  • code prints false
  • code prints >= false
  • compilation error

Questão 20

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

Questão 21

Questão
how can you include encapsulation in your class design
Responda
  • 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

Questão 22

Questão
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?
Responda
  • true, true, false
  • 10.0, false, false
  • false, false, false
  • compilation error

Questão 23

Questão
examine the following code and select the correct options
Responda

Questão 24

Questão
examine the following code and select the correct options
Responda
  • 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

Questão 25

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

Questão 26

Questão
which of the following statements are true?
Responda
  • 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

Questão 27

Questão
Given the following definition of class Person,
Responda
  • anotherMethod, anotherMethod, someMethod, someMethod
  • anotherMethod, EJava, someMethod, someMethod
  • anotherMethod, EJava, someMethod, EJava
  • Compilation error.

Questão 28

Questão
what is the ouput of the following code?
Responda
  • 20 10 11 11
  • 20 20 11 10
  • 20 10 11 10
  • compilation error

Questão 29

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

Questão 30

Questão
given the following code,
Responda
  • Compilation error
  • Rintime exception
  • int String
  • long Object

Questão 31

Questão
examine the following code and select the correct options:
Responda
  • 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

Questão 32

Questão
Select the incorrect options
Responda
  • 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() {} }

Questão 33

Questão
What is the output of the following code?
Responda
  • 4c010
  • 4c10
  • 113
  • 103
  • Compilation error

Questão 34

Questão
What is the output of the following code?
Responda
  • 0:0
  • a:b
  • 0:b
  • a:0
  • compilation error

Questão 35

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

Questão 36

Questão
Which of the following statements are correct?
Responda
  • 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.

Questão 37

Questão
Which of the following statements are correct?
Responda
  • 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.

Questão 38

Questão
What is the output of the following code?
Responda
  • 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

Questão 39

Questão
What is the output of the following code?
Responda
  • true printed once
  • false printed once
  • true printed in an infinite loop
  • false printed in an infinite loop

Questão 40

Questão
What is the output of the following code?
Responda
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Questão 41

Questão
What is the output of the following code?
Responda
  • gZmeAZ
  • gZmeAa
  • gZm
  • gZ
  • game

Questão 42

Questão
What is the output of the following code?
Responda
  • 12S512S5
  • 12S12S
  • 1025102S
  • dRuntime exception

Questão 43

Questão
What is the output of the following code?
Responda
  • 521
  • Runtime exception
  • 65321
  • 65431

Questão 44

Questão
What’s the output of the following code?
Responda
  • 10
  • 30
  • 31
  • 32

Questão 45

Questão
What’s the output of the following code?
Responda
  • 10
  • 30
  • 31
  • 32

Questão 46

Questão
Which of the following statements is true?
Responda
  • 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.

Questão 47

Questão
What’s the output of the following code?
Responda
  • true false ABC
  • false ABC
  • true ABC
  • Compilation error

Questão 48

Questão
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?
Responda
  • 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);

Questão 49

Questão
What’s the output of the following code?
Responda
  • default
  • default 4
  • 4
  • Compilation error

Questão 50

Questão
What’s the output of the following code?
Responda
  • default case1 case2
  • case1 case2
  • case2
  • Compilation error
  • Runtime exception

Questão 51

Questão
What’s the output of the following code?
Responda
  • ejava enum guru
  • ejava
  • ejavaguru e
  • ejava enum guru ejavaguru

Questão 52

Questão
What’s the output of the following code?
Responda
  • else
  • 0 1 2
  • 0 1
  • Compilation error

Questão 53

Questão
What’s the output of the following code?
Responda
  • Compilation error
  • 0 5
  • 0 5 10
  • 10
  • 0 1 5
  • 5

Semelhante

Acuerdo 8 Comité Directivo del Sistema Nacional de Bachillerato
Clases En Web
EVENTOS EN JAVA
**CR 7**
PROGRAMACIÓN ORIENTADA A OBJETOS - TERCER CORTE
Jose Anacona Pira
Simulador de Historia del Arte
Viktor Garcia
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
Java: Herencia y Polimorfismo
Ana Emilie
Publicidad en Búsquedas 1
Juan Antonio Gonzalez Lombana