Topics for Test 1 --
Spring 2020
Updates :
- 2020 Feb 27 03:55:46 PM: Removed (ie strike through) a few items and removed DRAFT
- 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 and subtypes: Integer, Natural, Positive, Float
- Basic types: Boolean, String, Character
- Literals: Integer, Float, Character, String
- Type conversions
- Type and variable 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, get_line, put, etc
- Arrays: Constrained and Unconstrained
- Declare blocks
- Other points on basic syntax and 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;
- Java vs Ada for loop
- Procedures and functions
- Define and contrast basic terms: procedure, function, routine,
subprogram, 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)
- Named vs positional parameter passing
- Actual vs formal parameters
- 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
- Relation to Parnas Principle: maximize cohesion, minimize coupling
- Arrays
- Declare an array variable of anonymous type
- Define a constrained array type
- Unconstrained array types:
- Define an unconstrained array type
- Use an unconstrained type to declare a constrained array
- Use an unconstrained type to define a constrained array type
- Analyze code
- Describe benefits and motivation, particularly wrt to parameters
- Use with declare blocks
- 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 assignment and comparison. For assignment length must match also.)
- 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)
- get_line, declare blocks, and parameters
- Analyze and write programs that use strings
- Array topics apply also to strings
- Types
- 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)
- Strong typing and type conversion:
- Basic type checking rule and where it applies
- Apply definition in assignment statements, parameters,
return types, and operators and/or 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.
-
Widening and narrowing conversions
- Implicit vs explicit conversions
- What happens on conversion:
- Compile time: it's okay (go ahead and let me do this)
- Runtime:
- Possible that no RT action is needed
- Representation change may be needed
- Check for valid value may be needed
- Use conversions appropriately
- Subtype conversion:
- Compile time check and action, and runtime actions
- New integer types
- Signed Integer types: interpret, conversions and type checking
-
Modular types - Interpret, define, describe legal values, and define and interpret
arithmetic
- Read and interpret code
- Type checking and conversions
- I/O - what needs to be done and why
- Side effects (in expressions, functions, and procedure calls):
- Define and/or describe what they are
- Define program state and its relation to side effects
- Describe why we avoid them
- Describe relation to global variables
- Other ideas we've discussed:
- Catch errors as early as possible
- Contracts in programming increase reliability
- Complexity: Major problem in CS
- Abstraction: solution to complexity
- Tradeoffs: examples: flexibility vs efficiency
The following topics are NOT on the Spring 2019 FIRST EXAM:
- Unix Commands
- Be able to describe, interpret, and use basic commands for files and directories
- Examples: ls, cp, mv, mv, rm, cd, pwd, mkdir, rmdir, ~, ., .., absolute/relative path
- Example switches: ls -l
- 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
- Strong typing:
- Contrast with C, C++
- Definition (ie compile time and run time checks that verify that
operations are performed only on valid values)
- Three kinds of strings: fixed, bounded, unbounded
- Compared to java and C
- Tradeoffs
- 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
- 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)
- 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
- Procedural Goals and features needed to support them
- Language goals: reliability,
efficiency, concern for programmer,
programming in the large
- List and define goals and list and explain how various features support the goals
- Subtype conversion:
- Comparison of Ada and Java with respect to Inheritance