Topics for Test 1 --
Fall 2018
Updates :
- Updated for Fall 2018
- Material
- Material from class and web page notes
- From the text: As mentioned in web pages - reference only. Nothing will be
directly taken from the text.
- Material from first and second assignment
- Read and write complete programs using following features:
- With and use
- Main procedure
- Declaration section: constants, types, more constants, procedures, variables
- Basic types: Boolean, string, character
- Literals: integer, float, character, string
- Type conversions
- Type attributes (eg 'first, last, range)
- Range constraints and subtypes
- Nested procedures and functions with appropriate parameters, parameter modes, return
types, and local variables
- Control structures: if, elsif, case, loop, exit when
-
Ada.{Integer,Float,}_Text_IO
get and put, etc
- Arrays
- Other points on basic programs:
- Cardinal rule 1: define before use
- Cardinal rule 2: Strong typing requires same named type for
assignment, parameters, return types, and most operators
- Can use subtype where parent type is expected
- With and use: describe where each can appear, what each accomplishes and when,
and compare and contrast them with Java import statement
- Loop and a half - write code and describe motivation
- loop get(x); exit when test(x); process(x); end loop;
- Procedures and functions
- Define and contrast basic terms: procedure, function, routine, subroutine, method
- Describe where procedures can be declared: a procedure can be the main routine,
nested inside another routine, defined in a package (eg ada.text_io.put)
- Contrast procedures and functions with respect to statements and values. Contrast with Java and
the C family.
- Parameter Modes: in, out, in out
- Describe semantics and motivation, how to use
- Describe how modes provide a contract model of communication between a routine
and it's caller
- Select the best mode for a given application
- Error checking made possible by parameter modes
- Scope of declarations, local and global variables :
- Define scope. State and apply Ada's scope rule
- Define local and global variables
- Compare scope of Ada local to Java locals and fields
- Describe problems with global variables
- Enumerated types:
- Define and/or explain what an enumerated type is
- Explain the motivation for them
- Understand and write an appropriate declaration for an enumerated type
- List and use some operations and attributes on enumerated types
(eg 'first, 'last, 'range)
- NOT FOR FALL 18: Explain how IO for enumerated types is accomplished (ie generic packages) and why this approach is needed
- Describe approaches taken for enumerated types in Java and C and the pros and cons of these approaches
(ie final ints and class Enum)
- Arrays
- Declare an array variable of anonymous type
- Declare a constrained array type
- Unconstrained array types:
- Declare an unconstrained array type
- Use an unconstrained type to declare a constrained array
- Use an unconstrained type to declare a constrained array type
- Analyze code
- Describe benefits and motivation, particularly wrt to parameters
- Interpret and use basic attributes: 'range, 'first, 'last, 'length
- Declarations and bounds: describe and explain benefits of specifying bounds
- Operations: Describe, analyze, and use these operations:
- Assignment
- Equality
- Aggregate assignment
- Slicing
- Describe and apply the rule for when arrays can be assigned or compared (ie
type names must match for comparison, and name and length must match for
assignment
- Reference and value semantics as related to arrays
- Define reference and value semantics
- Define alias and relate it to reference and value semantics
- Analyze and write Ada and Java code that illustrates
the semantics of each language and contrasts the two languages
- Multidimensional - memory layout
(row vs column major), comparison with Java
- Strings and their implementation:
- Describe implementation of Strings:
- String variables are fixed length arrays of characters
- Length can't change
- Type String is unconstrained
- String variables are constrained arrays
- Strings can be modified (ie not immutable)
- Analyze and write programs that use strings
- Array topics apply also to strings
- Type model
- What is a type (ie set of values and set of operations)
- Know and be able to use basic built-in types: Integer, Float, Character, Boolean
- Describe and use subtypes and range constraints and describe the motivation for them
- Know and be able to use type attributes: 'First, 'Last, 'Range, ...
(for numeric and other types and variables)
- Range constraints and subtypes (define and use and explain benefits)
- New integer types
- Strong typing and type conversion:
- Basic type checking rule and where it applies
- Apply definition in assignment statements, parameters, and expressions
- Contrast type checking of subtypes and distinct types
- Type conversions:
- Describe, compare, and contrast implicit and explicit conversions of types
and subtypes in Java and Ada.
- Use conversions appropriately
- Reliable programming - describe reliability features and contrast with Java:
- With and use
- Comments
- Literals
- Range constraints and subtypes
- New integer types
- If, elsif, end if
- Case: when others (required?), no break
- Loops
- Functions vs Procedures
- Parameters - mode and keyword
- Procedural language topics:
- Procedural language characteristics
- Procedural application areas
- Procedural Goals and features needed to support them
- Ada design goals
- Examples reflecting design goals
- Topics on procedural application areas and Ada design goals
- Side effects (in expressions and procedure calls): describe what they are and why we avoid them and their relation to global variables
- Other ideas we've discussed:
- Catch errors as early as possible
- Complexity: Major problem in CS
- Abstraction: solution to complexity
- Tradeoffs: examples: flexibility vs efficiency
- Subtype conversion:
- Compile time and Runtime actions
- Comparison of Ada and Java with respect to Inheritance
- Unix Commands
- Be able to describe, interpret, and use basic commands for files and directories
- Examples: ls, mv, mv, rm, cd, pwd, mkdir, rmdir, ~, ., .., absolute/relative path
- Example switches: ls -l
The following topics are NOT on the Fall 2018 FIRST EXAM:
- Modular types - define, describe legal values, and define and interpret arithmetic
- Topics related to floating point, representation, and unchecked conversion:
- Describe, compare, and contrast what happens in an unchecked conversion and what
happens in a type conversion (ie in type casting)
- Describe and use contents of a bit array as used in the programming
assignments.
- Structure charts: sequence, loop, if, information passing, procedures
- Use as a design tool
- Sequence, loop, if, information passing, procedures
- Top down and bottom up design
- Other types: describe and explain motivation for them and compare to Java
- New float types
- Fixed point types
- Enumeration types
- Type model/strong typing:
- Contrast with Java, C, C++
- Give definition: compile time and run time checks that verify that
operations are performed only on valid values
- Three kinds: fixed, bounded, unbounded
- Ada execution model
- Describe compilation and linking: source, object, and executable files
- Describe and compare with Java's model:
interpreted class files vs directly executed executable files
- Analyze and give examples showing the problem areas in the syntax of the C family
of languages
- Topics on IO:
- Integer and float get skip white space
- Integer and float IO get/put convert from/to ASCII strings (in binary) to/from binary numbers
- automatic conversion of ints to floats
- look_ahead(c, eol)
- Parameters modes:
- Implementation: Approaches of Ada, Java, C, C++
- Formal and actual Parameter ++
- Topics on Value vs reference semantics
- Benefits
- Primitive vs structured types