Unit 1 - CH 2 Flashcards
Programming (C#) (45 cards)
Define Variable
A location in memory that contains one or more data values
Define Identifier
A unique name given to a variable, procedure, or function, etc
Define High-level programming language
A language that has English-like keywords and commands to express the basic constructs of sequence, selection, and iteration
Define Integer Division
A process that returns only the whole number section of a division.
E.g. 7/2 = 3.5 but integer division would return 3
Define Compiler
A program that translates source code into executable object code
Define Console Application
A program that runs on a text-based window into which the user types and which displays text output from the computer
C# Integer Division
int wholeNumberPart = num1 / num2
C# modulo operation
int remainder = num1 % num2
C# commenting
Single line // comment
Multi line /* comments */
C# user input
string input = Console.Readline ()
C# display/output
Display and leave cursor on same line
Console.Write (“Heya”)
Display and move cursor to newline
Console.WriteLine (“Coolio”)
C# string formatting layout
Console.WriteLine(“{0} plus {1} is {2}”, num1, num2, sum);
Define Global variable
A variable declared at the beginning of a program and accessible from anywhere in the program.
Not always desirable as its values 0may be accidentally changed
Define Local variable
A variable declared in a program block and only accessible within the scope of that routine.
Define Constant
A variable whose value does not change throughout the program runtime
What is the difference between an integer and a real number?
Integers are whole numbers, real numbers can have a fractional part/decimal point.
Why use int instead of real?
They use less memory and store values accurately.
Define string
A sequence of zero or more characters
Define character
Any letter, number, or symbol in a character set such as ASCII
C# string accessing
charThree = aString [4]
Zero-indexed
C# dateTime usage
dateTime today;
today = DateTime.Today;
dateTime tomorrow = today.AddDays (1);
dateTime anniversary = System.Convert.ToDateTime (“08/09/2017”);
Define Record
A data structure that groups a number of variables.
Lightweight classes, basically.
What data structure is this?
struct Book { public string Title, ISBN; public decimal Price; public int PublicationYear; }
Book theMazeRunner;
theMazeRunner.Title = “The Maze Runner”
Defining and then initializing a record in C#
Define Enumerated type
An ordered set of values