CS21 Java - CH 1 exam with complete
j j j j j j j
solutions 2024
j j
j
Why jdo jcomputers juse jbinary jnumbers? j- jANSWER✓✓-It jis jeasier jto jbuild
jelectronic jdevices jreliably jif jthey jonly jhave jto jdistinguish jbetween jtwo jelectric
jstates.
What jis jthe jdifference jbetween jthe jfile jMyProgram.java jand jthe jfile
jMyProgram.class? j- jANSWER✓✓-MyProgram.java jis ja jsource jcode jfile jtyped
jby jthe jprogrammer, jand jMyProgram.class jis ja jcompiled jexecutable jclass jfile
jthat jis jrun jby jthe jcomputer.
Which jof jthe jfollowing jis jthe jcorrect jsyntax jto joutput ja jmessage? j-
jANSWER✓✓-System.out.println("Hello, jworld!");
System.out.println("name\tage\theight");
System.out.println("Archie\t17\t5'9\"");
System.out.println("Betty\t17\t5'6\"");
System.out.println("Jughead\t16\t6'"); j- jANSWER✓✓-name jage jheight
Archie j17 j5'9"
Betty j17 j5'6"
Jughead j16 j6'
System.out.println("\ta\tb\tc");
System.out.println("\\\\");
System.out.println("'");
System.out.println("\"\"\"");
System.out.println("C:\nin\the jdownward jspiral"); j- jANSWER✓✓-a jb jc
\\
'
"""
C:
in jhe jdownward jspiral
"Several jslashes jare jsometimes jseen,"
said jSally. j"I've jsaid jso." jSee?
\ j/ j\\ j// j\\\ j/// j- jANSWER✓✓-System.out.println j("\"Several jslashes jare jsometimes
jseen,\"");
System.out.println j("said jSally. j\"I've jsaid jso.\" jSee?");
System.out.println j("\\ j/ j\\\\ j// j\\\\\\ j///");
j j j j j j j
solutions 2024
j j
j
Why jdo jcomputers juse jbinary jnumbers? j- jANSWER✓✓-It jis jeasier jto jbuild
jelectronic jdevices jreliably jif jthey jonly jhave jto jdistinguish jbetween jtwo jelectric
jstates.
What jis jthe jdifference jbetween jthe jfile jMyProgram.java jand jthe jfile
jMyProgram.class? j- jANSWER✓✓-MyProgram.java jis ja jsource jcode jfile jtyped
jby jthe jprogrammer, jand jMyProgram.class jis ja jcompiled jexecutable jclass jfile
jthat jis jrun jby jthe jcomputer.
Which jof jthe jfollowing jis jthe jcorrect jsyntax jto joutput ja jmessage? j-
jANSWER✓✓-System.out.println("Hello, jworld!");
System.out.println("name\tage\theight");
System.out.println("Archie\t17\t5'9\"");
System.out.println("Betty\t17\t5'6\"");
System.out.println("Jughead\t16\t6'"); j- jANSWER✓✓-name jage jheight
Archie j17 j5'9"
Betty j17 j5'6"
Jughead j16 j6'
System.out.println("\ta\tb\tc");
System.out.println("\\\\");
System.out.println("'");
System.out.println("\"\"\"");
System.out.println("C:\nin\the jdownward jspiral"); j- jANSWER✓✓-a jb jc
\\
'
"""
C:
in jhe jdownward jspiral
"Several jslashes jare jsometimes jseen,"
said jSally. j"I've jsaid jso." jSee?
\ j/ j\\ j// j\\\ j/// j- jANSWER✓✓-System.out.println j("\"Several jslashes jare jsometimes
jseen,\"");
System.out.println j("said jSally. j\"I've jsaid jso.\" jSee?");
System.out.println j("\\ j/ j\\\\ j// j\\\\\\ j///");