C# study - Sheet1 Flashcards
In .NET, you don’t immediately create operating system-specific native code. Instead, you compile into Common Intermediate Language code.
T
What is the term for the .Net method of freeing up unused memory?
Garbage Collection
C# is a typesafe language.
T
Console applications are simple command-line applications
T
What type of language is C#
block-structured language
What are comments for?
Adding descriptive text to code.
Name four integer types.
byte, short, int, long
A string is a sequence of numbers
F
Give an example of a camelcase variable name.
firstName
What are the allowed value of Boolean?
True or False
What are the 3 categories that operators can be divided into
Unary, Binary, Ternary
Variables are chunks of data that have a name and a type.
T
What are the three branching techniques available in C#?
Ternary, If, Switch
In a switch statement, it is legal to execute more than one case.
T
Looping refers to the repeated execution of statements.
T
How do implicit and explicit conversions differ?
Implicit: conversion is possible in all circumstances, and the compiler can do it. Explicit: conversion is possible only in certain circumstances.
Structs can’t have different data types in them
F
What is the term for variable in a struct?
data members
What is a struct?
data structures that are composed of several pieces of data, possibly of different types.
How many base types are in an array?
1
How do you declare an array?
[] ;
What do foreach loops enable?
Enables you to address each element in an array.
A jagged array is an array of arrays of different lengths.
T
When a function returns a value, you have to specify the type in the function declaration, and use the return keyword at the end of the function’s execution.
T
Passing a parameter by reference means the referenced variable will be used each time a function is run rather than using a constant number.
T
Global variables can have a scope of more than one function?
T
A delegate is a type that enables you to store references to functions.
T
What is the main advantage of using Release builds?
Release builds run faster.
When in debug mode in Visual Studio the step into command will execute and move to the next statement to be executed.
T
Error handling is the term for all techniques involving finding and correcting errors.
T
Nondefault constructors are constructors that include starting parameters
T
Default constructors are parameter-less methods (that don’t return anything).
T
Who are static members shared with?
They are shared between instances of a class.
Interfaces can exiswt on their own.
F
What is an interface?
A collection of private instance methods and properties that are grouped together.
What does the term inheritance mean in OOP?
It wil have all the members of the class from which it inherits.
In C#, all classes derive from the base class Parent at the root of the class.
T
What does polymorphism allow?
All objects instantiated from a derived class can be treated as if they were instances of a parent class.
What is containment?
One class contains another.
What is the base class in C#?
System
Abstract classes can posses both abstract members and non-abstract members.
T
Abstract classes can contain members that can be inherited by a derived class, while interfaces cannot.
T
When you assign an object to a variable, you are actually assigning that variable with a pointer to the object to which it refers.
T
A full copy is referred to as a deep copy.
T
Within a class definition, all members have the same accessibility levels.
F
Public members are accessible from any code
T
Protected Members are accessible only from code that is part of either the class or a derived class.
T
A Field is like a variable.
T
A method is like a function.
T
Fields, methods, and properties can also be declared using the keyword global, which means they are static members owned by the class.
F
Where can you access private members from?
Code that is part of the class.
Which keyword’s members are accessible only from code within the assembly (project) where they are defined
Internal
What are the four class definition modifiers for accessibility?
public, private, internal, protected
If override is used, then sealed can also be used to specify that no further modifications can be made to this method in derived classes
T
Accessors are defined using get and set keywords respectively, and can be used to control the access level of the property.
T
What does the override method do?
overrides a base class method.
Properties contain a type name, a property name, and one or both what kind of blocks?
Get / Set
You must use an accessor to make a property useful.
T
Properties use the same keywords as fields and methods.
T