Chapter 1 Flashcards
What is an algorithm?
Algorithm is a set of ordered and finite steps to resolve a given problem.
What is a program?
A program is a set of precise instructions to complete a task.
What is a flowchart?
A flowchart is a graphical representation of an algorithm.
What is a decision table?
Decision tables are used when an algorithm involves a large number of conditions. They are a more compact and readable format for presenting algorithms.
What is C#?
C# is a high level language that allows you to write computer programs in a human readable format. It is part of the .NET framework and benefits from the runtime support and class libraries provided by the framework.
What are the 3 main components of the .NET framework?
1) Runtime execution environment
2) Set of class libraries reusable
3) Language compilers for C#, Visual Basic and C++
What do modern high level languages e.g. C# do?
They allow us to write precise human readable instructions that a language compiler can translate into lower level language that can be understood by the runtime execution system.
What happens when a C# program starts?
Visual studio calls the .NET compiler, which translates it to lower level language, Common Intermediate Language. This is stored in an .exe file also known as an assembly.
Before this code can be executed it must be translated by the .NET framework runtime execution system in a process called just in time compilation.
What is CIL?
Common Intermediate Language is the lowest level human readable programming language. It is an object-orientated assembly language.
Before this code can be executed it must be translated by the .NET framework runtime execution system in a process called just in time compilation.
What is a class?
A class is a set of data and methods, which is defined using the class keyword and class name.
What is a namespace?
Namespaces are used to organise classes and uniquely identify them.
Namespace and class name combine to create a fully qualified name e.g. namespace.class.
.NET framework provides a large number of useful classes such as the System namespace which contains Console class.
What is a fully qualified name?
A fully qualified name is the complete path of an identifier e.g. System.console.
What is the main method?
The main method serves as the entry point to a program.
Always starts when a program starts.
Can have only 1 main method in a program.
The main method must always declared as static.
What is a static method?
A static method allows you to call the method without having to create an instance of it.
What is instantiation?
Instantiation is the creation of an object in object-oriented programming. An instantiated object is given a name and created in memory or on disk using the structure described within a class declaration. Referred to as creating an instance of an object.
What is a variable?
Variables provide temporary storage during the execution of a program. They must have a name and a data type.
Must be unique within the scope that they are declared in.
Name must begin with a letter or underscore and can only contain letters, numbers or underscores.
What is a constant?
Constants are fields or local variables whose value cannot be changed.
Declared using the const keyword.
What is a data type?
A data type defines the size in memory needed to store the data and the kind of operation that can be performed on the data.
Can create own data types using class or a struct.
What data types are 1 byte in size?
Byte
What data types are 2 bytes in size?
Char
Short
Bool
What data types are 4 bytes in size?
Int
Float
What data types are 8 bytes in size?
Long
Double
What are primitive data types?
Built-in data types provided by C# that can be used in programs e.g. int, float, bool, char etc.
What is the string data type?
The string data type is a reference type as opposed to value types such as int, bool etc.
What is an array?
An array is a collection of items, which each have a unique index.
It is zero based i.e. index 0 refers to the first item in the array.
What is an operator?
Operators specify which operation to perform on operands before returning a result.
Can be either:
Unary - work with 1 operand each e.g. ++i
Binary - takes 2 operands e.g. x + y
Ternary - takes 3 operands e.g. ?: