Basics Flashcards
Define method.
A method performs an action in a series of statements.
Define statement block
a pair of braces containing zero or more statements.
What is an argument.
An argument is data passed to a method as a parameter.
C# recognizes a method called ______ as signaling the default entry point of execution.
Main
static int Main(string[] args) { . . . }
List the main types of functions supported by C#.
constructors, methods, operators, properties, events, indexers, and finalizers.
At the outermost level of a program, types are organized into _______.
namespaces
The using directive is used to make a namespace available to an application.
The C# compiler compiles source code, specifies as a set of files with the .cs extension, into an _______.
assembly.
An assembly is the unit of packing and deployment in .NET and can be either an application or a library.
What is the name of the C# compiler?
csc.exe
What is an Identifier?
Iderntifiers are names that programmers choose for their classes, methods, variables, and so on.
An identifier must be a whole word, made up of Unicode characters starting with a letter or underscore and are case-sensitive.
What is a keyword?
Keywords are names that mean something special to the compiler and are reserved, which means they can not be used as an identifier.
List all of the keywords
abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void volatile while
Is it possible to use a keyword as an identifier? If so, how?
It is possible to use a keyword as an identifier by qualifying it with the @ prefix.
Is @varName == varName?
The @ symbol doesn’t form part of the identifier itself so @varName is the same as varName.
What is a literal?
Literals are primitive pieces of data lexically embedded into the program and also known as fixed values.
It is essentially a language type with an associated value. int dayInMonth = 9;
What is a punctuator?
A punctuator help demarcate the structure of a program.Common punctuators include: { } [ ] ‘ “ ;
What is an operator?
An operator transforms and combines expressions. Common operators include * / + - % = ( )
What is a type?
A type defines the blueprint for a value
Which predefined types in C# are value types?
Numeric: - signed integer(sbyte, short, int, long), unsigned integer ( byte, ushort, uint, ulong), real number ( float, double, decimal ); Logical: -bool; Character: - char
Which predefined types in C# are reference types?
String & Object
List the Numeric suffixes
F float float f = 1.0F; D double double d = 1D; M decimal deciimal d = 1.0M; U uint uint = 1U; L long long i = 1L; UL ulong ulong i = 1UL;
The suffixes U and L are rarely necessary, because the uint, long, and ulong types can nearly always be either inferred or implicitly converted from int.
The F and M suffixes are the most useful and should always be applied when specifying float or decimal literals. Without the F suffix, the following line would not compile, because 4.5 would be inferred to be of type double, which has no implicit conversion to float:
float f = 4.5F;
True or False: When using ==, a NaN value is never wqual to another value, even another NaN value:
True
List the escape characters
Char Meaning Value \' Single quote 0x0027 \" Double quote 0x0022 \\ Backslash 0x005C \0 Null 0x0000 \a Alert 0x0007 \b Backspace 0x0008 \f Form feed 0x000C \n New line 0x000A \r Carriage return 0x000D \t Horizontal tab 0x0009 \v Vertical tab 0x000B
True or False:
Objects are stored in memory on the Stack and variables/parameters are stored on the Heap.
False:
Variables and parameters are stored on the Stack which grows and shrinks as they these types are allocated and deallocated; while Objects are created on the Heap.
Default Values
All type instances have a default value. List them.
Type Default value All reference types null All numeric types 0 enum types 0 char type '\0' bool type false