Está en la página 1de 9

Chapter 1: Creating Your First Java Classes

TRUE/FALSE 1. The Java interpreter converts source code into a binary program consisting of bytecode. ANS: F REF:

!. Everything that you use "ithin a Java program must be part of a c#ass. ANS: T REF: 1$

%. A c#ass name cannot be a Java reserved &ey"ord' such as pub#ic or c#ass. ANS: T REF: 11

(. The main( ) method returns a va#ue to the operating system. ANS: F REF: 1%

). Either First.java or first.java is an appropriate fi#e name for the First c#ass. ANS: F MULTI LE C!"ICE 1. E# t*rmino+++++++ se refiere a #as reg#as gramatica#es de un #engua,e de programaci-n. a estructura c sem.ntica . . b #-gica d sinta/is . . REF: 1

ANS: 0

REF: !

!. 1n ++++++++++traduce un programa entero antes de e,ecutar#o. a e,ecutor c interprete . . b traductor d compi#ador . .

ANS: 0

REF: %

%. E# #engua,e de programaci-n +++++ es compi#ador e interprete a #a ve2. a 344 c 5isua# 6asic . . b Java d Ensamb#ador . .

ANS: 6

REF: %

(. Escribir programas ++++++++++ invo#ucran #a creaci-n de c#ases. a mode#o c de paradigmas . . b de procedimientos d orientados a ob,etos . .

ANS: 0

REF: (

). 1n programa escrito en Java se e,ecuta sobre una computadora hipotetica estandari2ada ##amada +++++++++++. a Java virtua# machine c interpretador . . b Java hypercube d tranductor . .

ANS: A

REF:

7. 8a ap#icaciones de +++++++++++ en Java soportan sa#ida de caracteres 9modo te/to: en una ventana de 0;S. a conso#a c basado+<eb . . b "indo"ed d mainframe . .

ANS: A

REF: =

. 8os argumentos en un m*todo aparecen dentro de ++++++++++++. a parentesis c punto y coma 9>: . . b brac&ets d coma 9': . .

ANS: A

REF: ?

=. 0entro de #a instrucci-n System.out.print#n9@First Java app#ication@:> ' #a sa#ida es un +++++++++. a m*todo c ob,ecto . . b procedimieto d c#ase . .

ANS: 3

REF: 1$

?. A3ua# de #as siguientes opciones es un nombre de c#ase no v.#ido en JavaB a Emp#eado c Cresupuesto!$$! . .

b 3hecar cuenta .

d .

c#ase1

ANS: 6

REF: 1$

1$. Cor convenci-n' #os nombres de c#ases en Java inician con un9a: ++++++++++. a asterisco c #etra minDscu#a . . b #etra mayDscu#a d dEgito . .

ANS: 6

REF: 11

11. The reserved &ey"ord ++++ is an access modifier. a continue c c#ass . . b import d pub#ic . .

ANS: 0

REF: 1!

1!. 3ua#Fuier caracter co#ocado entre dos ++++++++ a# inicio de una #Enea es ignorado por e# compi#ador. a asterisco c ampersand 9G: . . b diagona# invertida 9bac&s#ashes: d diagona#es 9for"ard s#ashes: . .

ANS: 0

REF: 1)

1%. 1n b#oFue de comentario inicia con ++++++++++. a HI c JJ . . b JI d JJI . .

ANS: 6

REF: 1)

1(. A3ua# es #a sa#ida de# siguiente programaB pub#ic c#ass Test K pub#ic static void main9String LM args: K System.out.print#n9@No#a programadores de Java@:> JJSystem.out.print#n9@So#o estoy probandoO@:> P P a No#a Crogramadores de Java c So#o estoy probandoO . . b No#a programadores de Java d No#a programadores de Java

So#o estoy probandoO

ANS: 0

REF: 1)

1). A1n programa en Java ##amado Cersona.,ava debera compi#arse usando cua# de #os siguientes comandosB a ,ava Cersona.,ava c ,avac Cersona.,ava . . b ,avac Cersona d ,ava Cersona . .

ANS: 3

REF: 17

17. 0espues de compi#ar e/itosamente Cersona.,ava' e# programa se puede e,ecutar usando e# comando +++++++++. a ,ava Cersona c ,ava Cersona.c#ass . . b ,avac Cersona.,ava d ,avac Cersona.c#ass . .

ANS: A

REF: 1

1 . A3ua# es #a sa#ida de# siguiente programaB pub#ic c#ass Reg#as K pub#ic static void main9String LM args: K System.out.print#n9@Java @:> System.out.print#n9@reg#asO@:> P P a Java . reg#asO b Java reg#as . c Java reg#asO . d Javareg#as .

ANS: A

REF: 1=

1=. A3ua# de #os siguiente argumentos para e# m*todo e/it9: indica Fue una ap#icaci-n a terminado e/itosamenteB a y c 1 . . b s d $ . .

ANS: 0

REF: !$

1?. E# m*tdod showMessageDialog( ) necesita ++++ argumento9s:. a $ c ! . . b 1 d % . .

ANS: 6

REF: !$

!$. E# ++++++++++es e# primer programa para detectar #os errores en #as reg#as de# #engua,e computaciona#. a compi#er c assemb#er . . b interpreter d operating system . .

ANS: A

REF: !1

!1. Si un progama se puede compi#ar e/itosamente pero produce resu#tados incorrectos' se dice Fue tiene errores +++++++++++. a de sinta/is c primarios . . b de #-gica d de primer orden . .

ANS: 6 C"M LETI"#

REF: !!

1. Qn programming' named computer memory #ocations are ca##ed ++++++++++++++++++++ because they ho#d va#ues that might vary. ANS: variab#es REF: % !. ++++++++++++++++++++ group individua# operations in a program into #ogica# units. ANS: Crocedures REF: ( %. ++++++++++++++++++++' both in the rea# "or#d and in soft"are' are made of attributes and methods. ANS: ;b,ects REF: )

(. Crograms that are embedded in a <eb page are ca##ed Java ++++++++++++++++++++. ANS: app#ets REF: = ). Crogram ++++++++++++++++++++ are nonRe/ecuting statements added to a program for documentation purposes. ANS: comments REF: 1( MATC!I#$ Match each item with a statement below. Attributes static Qnheritance dia#og bo/ 8itera# string Encapsu#ation Source code import e Co#ymorphism .

1. SeFuence of characters enc#osed by sing#e Fuotes. !. Statement used "hen you "ant to access a bui#tRin Java c#ass that is contained in a pac&age. %. The interpretation of the same "ord by the conte/t in "hich it is used. (. S1Q ob,ect resemb#ing a "indo" that disp#ays messages. ). Reserved &ey"ord that indicates a method may be accessed independent of an ob,ect. 7. The characteristics that define an ob,ect. . Niding data and methods "ithin an ob,ect. =. Feature by "hich a ne" c#ass may derive attributes and methods from an e/isting c#ass. ?. Crogramming statements "ritten in a highR#eve# #anguage. 1. ANS: 3 !. ANS: 6 %. ANS: E (. ANS: S ). ANS: F REF: ? REF: 1? REF: 7 REF: 1? REF: 1%

7. ANS: A . ANS: N =. ANS: Q ?. ANS: 0 S!"RT A#S%ER

REF: ) REF: 7 REF: 7 REF:

1. 0escribe the concept of machine #anguage. <hat prob#ems are inherent to programming in machine #anguageB ANS: 3omputers are constructed from circuitry that consists of sma## onJoff s"itches' so you cou#d "rite a computer program by "riting something a#ong the fo##o"ing #ines: first s"itchRon second s"itchRoff third s"itchRoff fourth s"itchRon Tour program cou#d go on and on' for severa# thousand s"itches. A program "ritten in this sty#e is "ritten in machine #anguage' "hich is the most basic circuitryR#eve# #anguage. The prob#ems "ith this approach #ie in &eeping trac& of the many s"itches invo#ved in programming any "orth"hi#e tas& and in discovering the errant s"itch or s"itches if the program does not operate as e/pected. Qn addition' the number and #ocation of s"itches vary from computer to computer' "hich means that you "ou#d need to customi2e a machine #anguage program for every type of machine on "hich you "ant the program to run. REF: ! !. <ho deve#oped JavaB <hat operating system9s: "as Java deve#oped forB ANS: Java "as deve#oped by Sun Uicrosystems as an ob,ectRoriented #anguage for genera# purpose business app#ications and for interactive <or#d <ide <ebRbased Qnternet app#ications. Some of the advantages that have made Java so popu#ar in recent years are its security features and the fact that it is architectura##y neutra#' "hich means that you can use Java to "rite a program that "i## run on any p#atform' or operating system. REF: %. <hat is JavaVs re#ationship to 344' and "hat are the advantages of Java over 344B ANS: Java a#so is simp#er to use than many other ob,ectRoriented #anguages. Java is mode#ed after 344. A#though neither #anguage is easy to read or understand on first e/posure' Java does e#iminate some of the most difficu#tRtoRunderstand features in 344' such as pointers and mu#tip#e inheritance. REF:

(. 0escribe #ine comments. ANS: 8ine comments start "ith t"o for"ard s#ashes 9JJ: and continue to the end of the current #ine. A #ine comment can appear on a #ine by itse#f or at the end of a #ine fo##o"ing e/ecutab#e code. REF: 1) ). 0escribe b#oc& comments. ANS: 6#oc& comments start "ith a for"ard s#ash and an asteris& 9JI: and end "ith an asteris& and a for"ard s#ash 9IJ:. A b#oc& comment can appear on a #ine by itse#f' on a #ine before e/ecutab#e code' or on a #ine after e/ecutab#e code. 6#oc& comments a#so can e/tend across as many #ines as needed. REF: 1) 7. 0escribe ,avadoc comments. ANS: Javadoc comments are a specia# case of b#oc& comments. They begin "ith a for"ard s#ash and t"o asteris&s 9JII: and end "ith an asteris& and a for"ard s#ash 9IJ:. Tou can use ,avadoc comments to generate documentation "ith a program named ,avadoc. REF: 1) . No" do you save a Java c#assB ANS: <hen you "rite a Java c#ass' you must save it using some storage medium' most often a dis&. Qn Java' if a c#ass is public 9that is' if you use the public access modifier before the c#ass name:' you must save the c#ass in a fi#e "ith e/act#y the same name and a .java e/tension.For e/amp#e' the First c#ass must be stored in a fi#e named First.java. The c#ass name and fi#ename must match e/act#y' inc#uding the use of upperR and #o"ercase characters. Qf the e/tension is not .java' the Java compi#er does not recogni2e the fi#e as containing a Java c#ass. REF: 17 =. After "riting and saving an app#ication' "hat t"o steps must occur before you can vie" the app#icationVs outputB ANS: 1. Tou must compi#e the c#ass you "rote 9source code: into bytecode. !. Tou must use the Java interpreter to trans#ate the bytecode into e/ecutab#e statements. REF: 17 ?. E/p#ain that concept of a #ogic error. ANS:

A #ogic error occurs "hen the synta/ of the program is correct and the program compi#es but produces incorrect resu#ts "hen you e/ecute it. This type of error is usua##y more difficu#t to find and cure than a synta/ error. REF: !! 1$. <hat is the Java ACQB ANS: ;f particu#ar va#ue is the Java app#ication programming interface' more common#y referred to as the Java ACQ. The Java ACQ is a#so ca##ed the Java c#ass #ibrary> it contains information about ho" to use every pre"ritten Java c#ass' inc#uding #ists of a## the methods you can use "ith the c#asses. REF: !%

También podría gustarte