Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
ef0c222c
Commit
ef0c222c
authored
9 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
simple codingbat string exercises
parent
86d569cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Doc/Sd1/languageFundamentals.xml
+42
-8
42 additions, 8 deletions
Doc/Sd1/languageFundamentals.xml
Doc/Sd1/preliminaries.xml
+5
-1
5 additions, 1 deletion
Doc/Sd1/preliminaries.xml
with
47 additions
and
9 deletions
Doc/Sd1/languageFundamentals.xml
+
42
−
8
View file @
ef0c222c
...
...
@@ -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"
>
...
...
This diff is collapsed.
Click to expand it.
Doc/Sd1/preliminaries.xml
+
5
−
1
View file @
ef0c222c
...
...
@@ -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>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment