From ef0c222c303320f5c6b5513f61b0533c4f385372 Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Wed, 2 Sep 2015 14:01:37 +0200 Subject: [PATCH] simple codingbat string exercises --- Doc/Sd1/languageFundamentals.xml | 50 +++++++++++++++++++++++++++----- Doc/Sd1/preliminaries.xml | 6 +++- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/Doc/Sd1/languageFundamentals.xml b/Doc/Sd1/languageFundamentals.xml index b2df671dd..0378bf46b 100644 --- a/Doc/Sd1/languageFundamentals.xml +++ b/Doc/Sd1/languageFundamentals.xml @@ -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"> diff --git a/Doc/Sd1/preliminaries.xml b/Doc/Sd1/preliminaries.xml index c857d91e0..947b68201 100644 --- a/Doc/Sd1/preliminaries.xml +++ b/Doc/Sd1/preliminaries.xml @@ -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> -- GitLab