1.
When you need to define an object type's characteristics, use an interface. When you need to define an object type's capabilities, use an abstract class.
2.
Interfaces are a legacy of older versions of C#, and are interchangeable with the newer abstract class feature.
3.
When you need a list of capabilities and data that are classes-agnostic, use an interface. When you need a certain object type to share characteristics, use an abstract class.
4.
You should use both an interface and an abstract class when defining any complex object.
Q 1 / 64
1.
Delegates are not supported in the current version of C#
2.
They cannot be used as callbacks.
3.
Only variables can be passed to delegates as parameters.
4.
They can be chained together.
Q 2 / 64
1.
reactive
2.
inherited callback
3.
task-based
4.
callback-based
Q 3 / 64
cs var type = typeof(SomeType); var attribute = type.GetCustomAttribute<SomeAttribute>(); cs var typeof(MyPresentationModel).Should().BeDecoratedWith<SomeAttribute>(); cs Attribute.GetCustomAttribute, typeof(SubControllerActionToViewDataAttribute) cs Attribute.GetCustomAttribute(typeof(ExampleController), typeof(SubControllerActionToViewDataAttribute))
1.
.
2.
.
3.
.
4.
.
Q 4 / 64
1.
Variables passed to out specify that the parameter is an output parameter, while ref specifies that a variable may be passed to a function without being initialized.
2.
Variables passed to ref can be passed to a function without being initialized, while out specifies that the value is a reference value that can be changed inside the calling method.
3.
Variables passed to out can be passed to a function without being initialized, while ref specifies that the value is a reference value that can be changed inside the calling method.
4.
Variables passed to ref specify that the parameter is an output parameter, while out specifies that a variable may be passed to a function without being initialized.
Q 5 / 64
1.
reflection
2.
serialization
3.
abstraction
4.
dependency injection
Q 6 / 64
cs private static object objA; private static object objB; private static void performTaskA() { lock (objB) { Thread.Sleep(1000); lock (objA) { } } } private static void PerformTaskB() { lock (objA) { lock (objB) { } } }
1.
a private class that uses multithreading
2.
multithread coding
3.
thread mismanagement
4.
a potential deadlock
Q 7 / 64
1.
Anonymous types don't have type names
2.
Anonymous types can only be static
3.
Anonymous types can be used only in struts
4.
Anonymous types don't work with LINQ.
Q 8 / 64
1.
when you need a jagged collection structure
2.
when you need to store values of the same type
3.
when you need to store key-value pairs rather than single values
4.
when you need an ordered, searchable list
Q 9 / 64
1.
The .Equals method compares reference identities while the == compares contents.
2.
The .Equals method compares primitive values while == compares all values.
3.
The .Equals method compares contents while == compares references reference identity.
4.
The .Equals method compares reference type while == compares primitive value types.
Q 10 / 64
1.
when you try to instantiate two objects at the same time in the same class or struct
2.
when you are trying to execute an action after a user event is registered
3.
when simultaneous instructions are waiting on each other to finish before executing
4.
when you try to execute a series of events simultaneously on multiple threads
Q 11 / 64
1.
It allows access to asynchronous methods in the C# API
2.
It allows thread pooling and synchronous processes in static classes.
3.
It allows the await keyword to be used in a method
4.
It allows access to synchronous methods in the C# API
Q 12 / 64
1.
a class or struct, including its variables and functions
2.
a primitive data type that can be created only at compile time
3.
a value type that can be used only with an abstract class
4.
an instance of a class or struct that includes fields, properties, and/or methods
Q 13 / 64
1.
`var<<!---->T> userData = new <<!---->T> { name = "John", age = 32 };`
2.
`var userData = new { name = "John", age = 32 };`
3.
`AType userData = new AType { name = "John", age = 32 };`
4.
`Anonymous<T> userData = new Anonymous<T> { name = "John", age = 32 };`
Q 14 / 64
`public void userInput(string charParamters) { }`
1.
nothing
2.
a Boolean
3.
a string variable
4.
an integer
Q 15 / 64
cs string[] employees = { "Joe", "Bob", "Carol", "Alice", "Will" }; IEnumerable<string> employeeQuery = from person in employees orderby person select person; foreach(string employee in employeeQuery) { Console.WriteLine(employee); }
1.
ascending
2.
unordered
3.
descending
4.
first in, first out
Q 16 / 64
1.
Namespaces
2.
LINQ
3.
Type Aliasing
4.
Assemblies
Q 17 / 64
/_ - Multiline /_ Single Line _/ / Single Line /_ Multiline _/
1.
/_/ - Single Line
2.
// Multiline
3.
//* Multiline
4.
// Single Line
Q 18 / 64
1.
Make it public
2.
Make it static
3.
Make it private
4.
Make it virtual
Q 19 / 64
1.
public int Age { get - set }
2.
public int Age: get set;
3.
public int Age (get, set );
4.
public int Age { get; set; }
Q 20 / 64
1.
a class that is denoted by the class keyword (can be seen and used by any other class in the system--thus it is by default public)
2.
something denoted by the abstract keyword and used system wide; if you want any program to create an object of a class you use the abstract class
3.
a class that is denoted by the virtual keyword
4.
a class that can be used only as base class
Q 21 / 64
1.
The thread is destroyed and memory is freed up.
2.
The thread runs in loop until the next assignment.
3.
The thread goes inactive in the background and waits for garbage collection.
4.
The thread returns to the pool for reuse.
Q 22 / 64
1.
a second base class
2.
a revised class
3.
a derived class
4.
a parent class
Q 23 / 64
1.
hide built-in operatores when necessary
2.
add methods to be interpreted by the compiler at runtime
3.
define how enums and other primitive value types work within the rest of the application
4.
define custom functionality for common operators like addition and equality
Q 24 / 64
1.
to delete duplicate data
2.
to bind namespaces and assemblies
3.
to query and transform data
4.
to connect assemblies
Q 25 / 64
1.
public List<string names> contacts = new List<string names>();
2.
public List(string names) contacts = new List(string names)();
3.
var contacts = new List<string>();
4.
var contacts = new List(string);
Q 26 / 64
1.
Throw clauses fire only at runtime, while throw exceptions can fire at any time.
2.
Throw exceptions overwrite the stack trace, while throw clauses retain the stack information.
3.
Throw clauses overwrite the stack trace, while throw exceptions retain the stack information.
4.
Throw exceptions fire only at runtime, while throw clauses can fire during compile time.
Q 27 / 64
1.
The return yield statement is missing at the end of the method.
2.
The method is missing an await keyword in its body.
3.
The wait keyword is missing from the end of the method.
4.
The yield keyword is missing from the method.
Q 28 / 64
1.
system actions that communicate directly with the compiler at runtime
2.
actions that execute when the code compiles, generating logs and test output
3.
actions that generate notifications, which are sent to their registered listeners
4.
user-only methods that send data to the application's back end
Q 29 / 64
1.
unordered collections of numerc values
2.
key-value pairs of any C# supported type
3.
class and struct instances
4.
multiple variables, or collections, of the same type
Q 30 / 64
`enum AppState { OffLine, Loading, Ready }`
1.
string currentState = (string)AppState.Loading;
2.
string currentState = AppState.Loading.integralVal;
3.
int currentState = AppState.Loading.rawValue;
4.
int currentState = (int)AppState.Loading;
Q 31 / 64
1.
d
2.
a
3.
b
4.
w
Q 32 / 64
cs public interface INameble { string FirstName { get; set; } string LastName { get; } }
1.
Both the FirstName and LastName properties need to be implemented.
2.
Neither, they are both optional.
3.
Only the LastName property needs to be implemented.
4.
Only the FirstName property needs to be implemented.
Q 33 / 64
1.
at runtime
2.
at compile time
3.
only when required
4.
only when programmatically loaded
Q 34 / 64
1.
A regular expression is a C# tool used to parse HTML
2.
A regular expression is a special text string for describing a search patters.
3.
A regular expression allows a variable to be passed by reference.
4.
A regular expression allows a class to conform to the Equatable protocol.
Q 35 / 64
1.
To define behaviours of the class
2.
To hold information and data contained in the class object
3.
To communicate between classes and object
4.
To store the class definition value
Q 36 / 64
1.
to increase code performance
2.
all of these answers
3.
when code reuse is a priority
4.
when type safety is important
Q 37 / 64
cs public delegate void AuthCallback(bool validUser); public static AuthCallback loginCallback = Login; public static void Login() { Console.WriteLine("Valid user!"); } public static void Main(string[] args) { loginCallback(true); }
1.
Login successful...
2.
Valid user!
3.
an error, because the method signature of Login doesn't match the delegate
4.
Login successful... Valid user!
Q 38 / 64
1.
public class User
2.
abstract User {}
3.
sealed class User
4.
private sealed class User
Q 39 / 64
1.
`var contacts = new List<string>();`
2.
`var contacts = new List(string);`
3.
`public List<string names> contacts = new List<string names>();`
4.
`public List(string names) contacts = new List(string names);`
Q 40 / 64
1.
non-static classes need to be initialized before use, while static classes do not
2.
non-static classes are accessible only from an interface while static classes are accessible from anywhere
3.
non-static classes need to initialize all class members at runtime, while static classes do not
4.
non-static classes do not need to be initialized while static classes do
Q 41 / 64
`public int age="28"`
1.
type safety
2.
single inheritance
3.
dependency injection
4.
multiple inheritance
Q 42 / 64
`public class User {}`
1.
Mark the User class with the `DeserializableAttribute`.
2.
Declare the class as `public serializable class User {}`.
3.
Mark the User class with the `SerializableAttribute` attribute.
4.
Declare the class as `private serializable class User {}`.
Q 43 / 64
1.
public delegate ResultCallback(int responseCode)
2.
public delegate void ResultCallback<(int) responseCode>;
3.
public void delegate ResultCallback<int responseCode>;
4.
public delegate void ResultCallback(int responseCode);
Q 44 / 64
1.
non-static methods always need to have a void return type
2.
non-static methods do not have access to static member variables
3.
static methods do not have to instantiate an instance of the class to call the method
4.
static methods always have to be public
Q 45 / 64
1.
public void event ResultCallback apiResult;
2.
public event ResultCallback(() -> apiResult);
3.
public event void ResultCallback
4.
public event ResultCallback apiResult;
Q 46 / 64
1.
if there is an error, it won't execute at all
2.
between the try and catch blocks
3.
after the try and catch blocks
4.
when the finally block overrides the catch block and executes in its place
Q 47 / 64
1.
public static string IsvalidName(this string i, string value) {}
2.
public static void IsvalidName(this string i, string value) {}
3.
public string IsvalidName(this string i, string value) {}
4.
public void IsvalidName(this string i, string value) {}
Q 48 / 64
1.
They do not support multiple inheritance.
2.
They support multiple inheritance.
3.
They can have only a set number of properties.
4.
They can have only a set number of methods.
Q 49 / 64
1.
Namespaces calculate code coverage at runtime.
2.
Namespaces compile application code together at compile time.
3.
Namespaces group code together into a single repository.
4.
Namespaces separate code into groupings, control access, and void naming collisions.
Q 50 / 64
cs private int _password; pubic int Password = { get; set; } cs private int _password; public int Password = _password; cs private int _password; public int Password { get -> _password; set-> _password = value; } cs private int _password; public int Password { get { return _password; } set { _password = value; } }
1.
cs
private int _password;
pubic int Password = { get; set; }
2.
cs
private int _password;
public int Password = _password;
3.
cs
private int _password;
public int Password
{
get -> _password;
set-> _password = value;
}
4.
cs
private int _password;
public int Password
{
get { return _password; }
set { _password = value; }
}
Q 51 / 64
1.
a collection of synchronous methods created during initialization that cannot be reused
2.
a collection of threads created during initialization that can be reused
3.
a collection of threads only recognized at compile time that can be reused
4.
a collection of asynchronous methods created at compile time that cannot be reused
Q 52 / 64
1.
A regular expressions allows a variable to be passed by reference
2.
A regular expression allows a class to conform to the Equatable protocol
3.
A regular expression is a C# tool used to parse HTML
4.
A regular expression is a special text string for describing a search pattern
Q 53 / 64
1.
XML
2.
JSON
3.
byte stream
4.
value stream
Q 54 / 64
1.
a variable that holds a reference to a value type and its content
2.
a specific value type that can be used only in callback methods
3.
a type that holds a reference to a method with a particular parameter list and return type
4.
a custom variable type that can be used in abstract classes
Q 55 / 64
1.
try, catch, valid, invalid
2.
try, valid, finally, throw
3.
try, catch, finally, throw
4.
finally, throw, valid, invalid
Q 56 / 64
1.
The is operator checks instance types, while the as operator checks the inherited type.
2.
The is operator checks primitive data types, while the as operator checks the object type.
3.
The as operator checks object type, while the is operator attempts to cast an object to a specific type.
4.
The is operator checks object type, while the as operator attempts to cast an object to a specific type.
Q 57 / 64
1.
The finally block is called during the execution of a try and catch block, while the finalize method is called after garbage collection.
2.
The finally block is called after the execution of a try and catch block, while the finalize method is called just before garbage collection.
3.
The finalize block is called before the execution of a try and catch block, while the finally method is called just before garbage collection.
4.
The finalize block is called during the execution of a try and catch block, while the finally method is called after garbage collection.
Q 58 / 64
1.
Null<string> username = null;
2.
string? username = null;
3.
Type<string>? username = null;
4.
Optional<string> username = null;
Q 59 / 64
1.
struct InvalidResponse: Exception {}
2.
class InvalidResponse: Exception {}
3.
public Exception InvalidResponse = new Exception ();
4.
public Exception InvalidResponse () -> Exception;
Q 60 / 64
1.
enum AppState = [Offline, Loading, Ready]
2.
enum AppState {"Offline", "Loading", "Ready"}
3.
enum AppState = {Offline, Loading, Ready}
4.
enum AppState {Offline, Loading, Ready}
Q 61 / 64
1.
A value type can be any primitive type, while reference types must be type-agnostic.
2.
A value type refers to another value, while a reference type refers to a value in memory.
3.
A value type stores an actual value, while a reference type is a pointer to a value.
4.
A value type is available only at runtime, while a reference type is available only at compile time.
Q 62 / 64
1.
The `break` keyword is used to break out of multiple iteration statements, while `continue` can only break out of code blocks that have single iterations.
2.
The `break` keyword literally breaks out of a control flow statement, while `continue` ignores the rest of the control statement or iteration and starts the next one.
3.
The `break` keyword literally breaks out of the current control flow code and stops it dead, while `continue` keeps executing the code after an exception is thrown.
4.
The `break` keyword jumps out of an iteration and then proceeds with the rest of the control flow code, while `continue` stops the executing code dead.
Q 63 / 64
1.
`public int userID <get, set>;`
2.
`public int userID [get, private set];`
3.
`public int userID { get; private set; }`
4.
`public int userID = { public get, private set};`
Q 64 / 64