Skip to content
Snippets Groups Projects
Commit ef0c222c authored by Goik Martin's avatar Goik Martin
Browse files

simple codingbat string exercises

parent 86d569cb
No related branches found
No related tags found
No related merge requests found
......@@ -305,9 +305,13 @@
<qandadiv>
<qandaentry>
<question>
<para>A <xref linkend="glo_Java"/> <code>int</code> is internally
being represented by 4 <link linkend="glo_byte">bytes</link>.
<inlineequation>
<para>In this exercise we look at an <code>int</code>'s the
largest and smallest possible value.</para>
<para>A <xref linkend="glo_Java"/> <code
xlink:href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html">int</code>
is internally being represented by 4 <link
linkend="glo_byte">bytes</link>. <inlineequation>
<m:math display="inline">
<m:msub>
<m:mi>00000000000000000000000000000101</m:mi>
......@@ -579,9 +583,8 @@ System.out.println("Maximum short value:" + maximum);
</question>
<answer>
<para>The programmer's question is basically easy to answer:
Since <code>short</code> variables are being represented by to
bytes their range is <inlineequation>
<para>Since <code>short</code> variables are being represented
by to bytes their range is <inlineequation>
<m:math display="inline">
<m:mrow>
<m:mo>[</m:mo>
......@@ -769,7 +772,7 @@ System.out.println("New value=" + a);
New value=-128</programlisting>
<para>Explain this strange behaviour. Moreover you'll find the
following code to rise a compile time error:</para>
following code yields a compile time error:</para>
<programlisting language="noneJava">byte a = 127;
System.out.println("value=" + a);
......@@ -785,7 +788,8 @@ System.out.println("New value=" + a);</programlisting>
<answer>
<para>A byte variable ranges from -128 to +127. Thus
incrementing 127 by 1 yields an overflow error.</para>
incrementing 127 by 1 yields -128 which is an overflow
error.</para>
<para>Since <xref linkend="glo_Java"/> uses <link
xlink:href="http://en.wikipedia.org/wiki/Two's_complement#firstHeading">Two's
......@@ -1046,6 +1050,36 @@ System.out.println("New value=" + a);</programlisting>
</qandaentry>
</qandadiv>
</qandaset>
<qandaset defaultlabel="qanda" xml:id="sw1QandaStringSuppExercise">
<title>Supplementary string exercises</title>
<qandadiv>
<qandaentry>
<question>
<para xml:id="sw1QandaStringCodingBatExtra">Work on the following
external exercises:</para>
<itemizedlist>
<listitem>
<para
xlink:href="http://codingbat.com/prob/p171896">helloName</para>
</listitem>
<listitem>
<para
xlink:href="http://codingbat.com/prob/p161056">makeAbba</para>
</listitem>
<listitem>
<para
xlink:href="http://codingbat.com/prob/p147483">makeTags</para>
</listitem>
</itemizedlist>
</question>
</qandaentry>
</qandadiv>
</qandaset>
</section>
<section xml:id="sw1LanguageFundamentalUsingFinal">
......
......@@ -76,7 +76,11 @@
\\192.168.111.9\xy05 respectively.</para>
<caution>
<para>External access requires <acronym>VPN</acronym></para>
<para>External access requires <link
xlink:href="https://wiki.mi.hdm-stuttgart.de/wiki/VPN">OpenVPN</link>.
Be sure to select <link
xlink:href="https://wiki.mi.hdm-stuttgart.de/wiki/VPN#OpenVPN_Konfigurationsdatei">HdM_MI_stud.ovpn</link>
to gain all MI related benefits.</para>
</caution>
</glossdef>
</glossentry>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment