What in C# is a general term referring to a member of the set {class, interface, structure, enumeration, delegate}?
A type
C# demands that all program logic be contained within a what?
Type definition
What is missing from this list of things that are each considered a type in C#?
interface, structure, enumeration, delegate
class
What is missing from this list of things that are each considered a type in C#?
class, structure, enumeration, delegate
interface
What is missing from this list of things that are each considered a type in C#?
class, interface, enumeration, delegate
structure
What is missing from this list of things that are each considered a type in C#?
class, interface, structure, delegate
enumeration
What is missing from this list of things that are each considered a type in C#?
class, interface, structure, enumeration
delegate
How do you create a global function or point of data in C#?
It is not possible in C#
What is the namespace that contains the C# Console class?
System
using System;
What feature made it so that this statement is no longer needed to write a simple C# hello world program?
Implicit global namespaces
What using statement is no longer needed to write a hello world program in C# with the new implicit global namespaces?
using System;
What is an example of iterating through a string array (called args) using the foreach keyword in C#?
foreach(string arg in args) {}
What is an example (C#) of iterating through a string array (called args) using a standard for loop?
for (int i = 0; i < args.Length; i++) {}
What is the case convention for all C# keywords?
lowercase
What is the case convention for all namespaces, types, and member names in C#?
PascalCase
What relatively new feature of C# can be used to eliminate much of the ceremony around the C# application's entry point?
Top-level statements
When not using top-level statements, what conventionally is the name for the class that includes the Main() method in a C# program?
Program
What method signifies the entry point of a C# application, and prior to C# 9 which introduced the top-level statement functionality, was required in every C# app?
Main()
What term refers to the class that defines the Main() method in a C# app?
The application object
What member of the C# Console class sends a text string and a carriage return to the standard output?
WriteLine()
How many files in a C# app are allowed to use top-level statements?
Only one
What can a C# Main() method do (if you want) to specify an application error code (or code that indicates success)?
Return an int instead of void
By convention, what integer returned by an app indicates success?
0
What is the C# Console method which is similar to WriteLine() but does not append a carriage return to the end of the text string it outputs?
Write()
What type in C# defines a set of static methods to do basic I/O?
Console
What is the C# Console method which allows you to receive information from the input stream up until the Enter key is pressed?
ReadLine()
What is the C# Console method that can be used to capture a single character from the input stream?
Read()
Does using the var keyword in C# result in dynamic typing?
No, it is still strongly typed
The C# Console methods that capture input and output are all called by being prefixed with the name of the class because they are what type of methods?
Static
What are the 2 steps to declare a local variable in C#?
Specify the type followed by the variable's name
At one point is it a good practice to assign an initial value to a declared variable in a language like C#?
At the time of declaration
What C# keyword is a shorthand notation for System.Int32?
int
How many bits is an int in C#?
32
How many bits is a uint in C#?
32
How many bits is a short in C#?
16
How many bits is a ushort in C#?
16
How many bits is a long in C#?
64
What C# keyword is a shorthand notation for System.Int16?
short
What is the highest value that a variable of type ushort can have in C#?
65535
What is the lowest value that a variable of type sbyte can have in C#?
-128
What is the highest value that a variable of type sbyte can have in C#?
127
What is the highest value that a variable of type byte can have in C#?
255
What C# keyword is a shorthand notation for System.Boolean?
bool
What type in the C# System namespace has the shorthand notation float?
Single
What type in the C# System namespace has the shorthand notation double?
Double
What C# literal can be used to assign a default value for the data type?
default
E.g.:
int myInt = default;
What is the keyword used in C# when declaring a variable using the default constructor?
new
What is the ultimate base class of all C# types?
System.Object
Can a class derive from ValueType in C#?
No
What creates a scope in C#?
Curly braces
{ }
What class in C# defines a set of methods common to all types in the .NET Core base class libraries including ToString(), Equals(), and GetHashCode()?
System.Object
Where are types that descend from ValueType (of which many numerical types derive from) allocated?
The stack
What word describes generating a variable of a type given a textual equivalent?
Parsing
What can be used as a digit separator character in C#?
_
E.g.:
Console.Write(123_456.12);
What is an example of what you might want to do using literal binary values like 0b_0001_0000 in C#?
Create bit masks
What is the property in C# that returns the length of the current string?
Length
What are the characters in C# called that when present in string literals, qualify how the character data should be printed to the output stream?
Escape characters
What is the escape character in C# that inserts a double quote into a string literal?
\"
What is the escape character in C# that inserts a single quote into a string literal?
\'
What is the escape character in C# that inserts a backslash into a string literal?
\\
What is the escape character in C# that inserts a horizontal tab into a string literal?
\t
What programming feature involves a string literal containing placeholders for values?
String interpolation
What is a string that is prefixed with the @ symbol in C# known as?
A verbatim string
What character can a string be prefixed with in C# that will disable the processing of the string literal's escape characters?
@
Where are reference types allocated in C#?
The managed heap
When a test for equality on reference types is performed in C# (== and !=) what is the condition for == to return true?
Both references point to the same object in memory (strings are a notable exception as they are reference types but compared by value)
Since methods called on strings in C# return new strings, we can say that strings are what?
Immutable
What properties of numerical types in .NET Core can be used to determine the range a given type can store?
MaxValue, MinValue
What is the C# namespace that defines BigInteger?
System.Numerics
What is the C# namespace that defines Complex?
System.Numerics
What refers to an implicit upward cast that does not result in a loss of data (e.g. Add() expects two int arguments but it can be called with two shorts because there is no possibility for data loss)?
Widening
What is the property in C# that returns the length of the current string?
Length
What method in C# is analogous to upcase in Ruby?
ToUpper()
What method in C# is analogous to downcase in Ruby?
ToLower()
What is the C# casting operator?
()
E.g.:
short answer = (short)Add(numb1, numb2);
What is the act of determining the composition of a type at runtime?
Reflection
What does using var to declare local variables in C# simply for the sake of doing so bring to the table?
Very little
It might be argued that the only time to use the var keyword in C# is when?
Defining data returned from a LINQ query
How is a scope created in C#?
Curly braces
Do && and || short-circuit in C#?
Yes
Do & and | short-circuit in C#?
No
What language construct/keyword in C# and other C-based languages allows you to handle program flow based on a predefined set of choices?
switch
What statement in C# takes a string and an out parameter, parses the string and assigns the parsed value to the out variable, and returns true if successful?
TryParse()
An object allocated on the garbage-collected managed heap in C# is what kind of type in general?
A reference type
How is a scope created in C, C#, Java, and other languages based on C?
Curly braces
When using the C# operators like == and != with reference types, when would a test for equality return true?
When the references point to the same object in memory
What enum in C# has values which can be used by overloads of methods like Equals() and Compare() to control how the comparisons are done with respect to things like culture?
StringComparison
What can we say about strings in C# that describes this: once a string object is assigned an initial value, the character data cannot be changed?
Strings in C# are immutable
Previous card
First card
Random order
Next card