C# Week 1

Description

C# Quiz on C# Week 1, created by Eric Booker on 20/06/2019.
Eric Booker
Quiz by Eric Booker, updated more than 1 year ago
Eric Booker
Created by Eric Booker over 5 years ago
73
0

Resource summary

Question 1

Question
What is visual studio?
Answer
  • an IDE for .NET development
  • a collection of classes
  • a collection of class libraries and other resuable components
  • The result of program compilation

Question 2

Question
What is the .NET Framework
Answer
  • an IDE for .NET development
  • a collection of class libraries and other reusable components for application development
  • an intermediate language that C# programs compile to
  • a collection of classes that can be used by other applications

Question 3

Question
What is MSIL?
Answer
  • An intermediate language that is the result of program compilation.
  • a runtime environment that provides common services
  • a collection of classes that can be used by other applications
  • a collection of class libraries and other reusable components

Question 4

Question
What are some services that the CLR provides?
Answer
  • memory management
  • garbage collection
  • exception handling
  • syntax error handling
  • logic error handling

Question 5

Question
What happens after you run a program?
Answer
  • MSIL is converted to the Machine's native code using a compiler called Just in Time
  • CLR is converted to the Machine's native code using a compiler called Just in Time
  • JIT is converted to the Machine's native code
  • The program is converted into machine language.

Question 6

Question
What is an access specifier?
Answer
  • a keyword to specify the accessibility of a type and its members
  • a keyword to specify the access level required to edit the program
  • a keyword that places a constraint on how a class library can be used

Question 7

Question
The [blank_start]private[blank_end] access specifier limits the accessibility of the member to within the defined class.
Answer
  • private
  • public
  • protected
  • internal
  • protected internal

Question 8

Question
The [blank_start]public[blank_end] access specifier has no limits and any members or types defined as public can be accessed outside the class and even outside the assembly.
Answer
  • public
  • private
  • protected
  • internal
  • unsealed

Question 9

Question
[blank_start]Internal[blank_end] is used when you want your class members to be accessible within the assembly.
Answer
  • Internal
  • external
  • contained
  • package
  • protected

Question 10

Question
[blank_start]Protected[blank_end] is used only when inheritance is used. Types or members using this modifier are only accessible from a child class.
Answer
  • Protected
  • Interal
  • Sealed
  • Packaged
  • Contained

Question 11

Question
byte, int, float, char and decimal are [blank_start]value types[blank_end].
Answer
  • value types
  • reference types

Question 12

Question
Struct is a [blank_start]value type[blank_end]
Answer
  • value type
  • reference type

Question 13

Question
Enumerations are a [blank_start]value type[blank_end].
Answer
  • value type
  • reference type

Question 14

Question
Class types are [blank_start]reference types.[blank_end]
Answer
  • reference types.
  • value types.

Question 15

Question
A delegate is a reference type.
Answer
  • True
  • False

Question 16

Question
Arrays are value types.
Answer
  • True
  • False

Question 17

Question
The default value of bool is [blank_start]false.[blank_end]
Answer
  • false.
  • true.

Question 18

Question
the default value of int is [blank_start]0[blank_end]
Answer
  • 0
  • 1

Question 19

Question
The resources within your application are called [blank_start]managed code[blank_end]
Answer
  • managed code
  • unmanaged code
  • packaged code
  • maintained code

Question 20

Question
Managed code is directly executed by the MSIL.
Answer
  • True
  • False

Question 21

Question
Any code developed in the .NET framework is managed code.
Answer
  • True
  • False

Question 22

Question
Any code developed outside the .NET framework is known as [blank_start]unmanaged code[blank_end]
Answer
  • unmanaged code
  • managed code
  • ethereal code
  • unpackaged code

Question 23

Question
FInalizers can be defined in structs.
Answer
  • True
  • False

Question 24

Question
A class can only have one finalizer.
Answer
  • True
  • False

Question 25

Question
Finalizers can be inherited and overloaded
Answer
  • True
  • False

Question 26

Question
Finalizers cannot be called. They are invoked automatically.
Answer
  • True
  • False

Question 27

Question
A finalizer can take modifiers and parameters.
Answer
  • True
  • False

Question 28

Question
When should you use finalizers?
Answer
  • Releasing un-managed resources
  • Releasing all resources
  • To finalize the declaration of every class

Question 29

Question
The [blank_start]common language runtime[blank_end] is in charge of managed code.
Answer
  • common language runtime
  • microsoft intermediate language
  • just in time compiler
  • machine language

Question 30

Question
When you compile a C#, Visual Basic, or F#, your output will be [blank_start]Intermediate Language[blank_end] code.
Answer
  • Intermediate Language
  • Machine
  • CLR
  • byte

Question 31

Question
When you want to run code in intermediate language form, the CLR will take over and start the process of [blank_start]just in time[blank_end] compiling.
Answer
  • just in time
  • intermediate level
  • direct
  • standard

Question 32

Question
A child class extending the parent class is an example of inheritance
Answer
  • True
  • False

Question 33

Question
C# supports multiple inheritance.
Answer
  • True
  • False

Question 34

Question
The [blank_start]virtual[blank_end] keyword is used to modify a method, property, indexer, or event declaration and allows it to be overridden in a derived class.
Answer
  • virtual
  • protected
  • unsealed
  • public

Question 35

Question
The [blank_start]override[blank_end] modifier is required to extend or modify an abstract or virtual implementation.
Answer
  • override
  • @override
  • inherit
  • extend

Question 36

Question
Overriding is a type of polymorphism.
Answer
  • True
  • False

Question 37

Question
You can override a non-virtual or static method.
Answer
  • True
  • False

Question 38

Question
A lambda expression is a block of code that is treated as [blank_start]________[blank_end]
Answer
  • an object
  • a method
  • a function
  • a struct

Question 39

Question
Lambda expressions can be represented as a delegate.
Answer
  • True
  • False

Question 40

Question
x = > x * x The left side of the lambda expression takes [blank_start]input parameters[blank_end] and the right side contains the [blank_start]expression.[blank_end]
Answer
  • input parameters
  • variable
  • expression
  • constant
  • method declaration
  • expression

Question 41

Question
A delegate is
Answer
  • a type that represents references to methods with a particular parameter list and return type
  • a type that can store any method
  • is used only in asynchronous programming
  • is the same as a callback in JavaScript

Question 42

Question
Delegates are used to pass methods as arguments to other methods.
Answer
  • True
  • False

Question 43

Question
Delegates allow [blank_start]methods[blank_end] to be passed as parameters.
Answer
  • methods
  • objects
  • structs
  • anything

Question 44

Question
Delegates cannot be used to define callback methods.
Answer
  • True
  • False

Question 45

Question
Delegates can be chained together.
Answer
  • True
  • False

Question 46

Question
Members marked as abstract must be implemented by classes that derive from the abstract class.
Answer
  • True
  • False

Question 47

Question
An interface cannot have access specifiers for functions. It is public by default.
Answer
  • True
  • False

Question 48

Question
An abstract class can have an access specifier for its functions.
Answer
  • True
  • False

Question 49

Question
An interface can provide complete implementation and not just method signatures.
Answer
  • True
  • False

Question 50

Question
Neither an interface not an abstract class can be instantiated.
Answer
  • True
  • False

Question 51

Question
An [blank_start]interface[blank_end] cannot have fields. An [blank_start]abstract class[blank_end] can have defined fields and constants.
Answer
  • interface
  • abstract class
  • abstract class
  • interface

Question 52

Question
An [blank_start]interface[blank_end] can only have abstract methods whereas an [blank_start]abstract class[blank_end] can have non-abstract methods.
Answer
  • interface
  • abstract class
  • abstract class
  • interface

Question 53

Question
A class can [blank_start]inherit one or more interfaces[blank_end] and only [blank_start]only one abstract class.[blank_end]
Answer
  • inherit one or more interfaces
  • inherit only one interfaces
  • a maximum of 2 interfaces
  • only one abstract class.
  • exactly two abstract classes
  • one or more abstract classes

Question 54

Question
An interface [blank_start]cannot[blank_end] have a constructor declaration
Answer
  • cannot
  • must
  • can

Question 55

Question
An abstract class [blank_start]can[blank_end] have the constructor declaration.
Answer
  • can
  • cannot
  • must

Question 56

Question
The applied to a class, the sealed modifier prevents other classes from inheriting it.
Answer
  • True
  • False

Question 57

Question
Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes, not instantiated on its own.
Answer
  • True
  • False

Question 58

Question
A struct type is a value type that is typically used to encapsulate small groups of related variables
Answer
  • True
  • False

Question 59

Question
A struct can be instantiated.
Answer
  • True
  • False

Question 60

Question
A struct can be inherited.
Answer
  • True
  • False

Question 61

Question
Structs can be instantiated without using the [blank_start]new[blank_end] keyword.
Answer
  • new
  • this
  • of
  • instantiate

Question 62

Question
This represents a valid struct instantiation.
Answer
  • True
  • False

Question 63

Question
The [blank_start]in[blank_end] keyword is used to pass by reference by it's arguments cannot be modified by the called method. The [blank_start]out[blank_end] keyword's arguments must be modified by the called method. The [blank_start]ref[blank_end] keyword's arguments MAY be modified.
Answer
  • in
  • out
  • ref
  • out
  • in
  • ref
  • ref
  • out
  • in

Question 64

Question
An argument that is passed to ref or in must be initialized before it is passed.
Answer
  • True
  • False

Question 65

Question
Out parameters do not require initialized arguments to be passed.
Answer
  • True
  • False

Question 66

Question
In arguments cannot be modified by the called method.
Answer
  • True
  • False

Question 67

Question
[blank_start]ref[blank_end] tells the compiler that the object is initialized before entering the function.
Answer
  • ref
  • in
  • out

Question 68

Question
[blank_start]out[blank_end] tells the compiler the compiler that the object will be initialized inside the function.
Answer
  • out
  • in
  • ref

Question 69

Question
With [blank_start]out[blank_end], it is necessary to initialize the value of a parameter before returning to the calling method.
Answer
  • out
  • in
  • ref

Question 70

Question
The passing of a value through the [blank_start]ref[blank_end] parameter is useful when the called method also needs to change the value of the passed parameter.
Answer
  • ref
  • in
  • out

Question 71

Question
The declaring of a parameter with the [blank_start]out[blank_end] keyword is useful when a method returns multiple values.
Answer
  • out
  • in
  • ref

Question 72

Question
When the [blank_start]out[blank_end] keyword is use, the data passed is one-way.
Answer
  • out
  • ref
  • in

Question 73

Question
When the [blank_start]ref[blank_end] keyword is used, the data may pass bidirectionally.
Answer
  • ref
  • out
  • in

Question 74

Question
Delegates can be used in implementing call-back methods or events.
Answer
  • True
  • False

Question 75

Question
A [blank_start]delegate[blank_end] is an [blank_start]object[blank_end] that refers to a [blank_start]method[blank_end].
Answer
  • delegate
  • namespace
  • callback
  • Enumerator
  • object
  • method
  • method
  • object

Question 76

Question
A function must be declared as a delegate before it's passed to another function.
Answer
  • True
  • False

Question 77

Question
[blank_start]Multicasting[blank_end] of a delegate allows a user to point to more than one method in a single call.
Answer
  • Multicasting
  • Typecasting
  • Variedcasting
  • Casting

Question 78

Question
An action delegate saves you from defining a custom delegate
Answer
  • True
  • False

Question 79

Question
Serialization is the process of converting an object into a stream of bytes.
Answer
  • True
  • False

Question 80

Question
Serialization allows the developer to save the [blank_start]state[blank_end] of an object and recreate it when needed.
Answer
  • state
  • type
  • class

Question 81

Question
To serialize an object in C#, you need the object to be serialized and, the stream to contain the serialized object, and a [blank_start]formatter.[blank_end]
Answer
  • formatter.
  • encapsulator
  • template
  • box

Question 82

Question
What is the namespace necessary to use serialization?
Answer
  • System.Runtime.Serialization
  • System.Serialization
  • System.Encapsulation.Serialization
  • System.Serializer

Question 83

Question
It is not necessary to apply the SerializableAttribute attribute to an object before serializing it.
Answer
  • True
  • False

Question 84

Question
The two type of serialization are:
Answer
  • binary and xml
  • binary and string
  • string and xml
  • serializable and binary

Question 85

Question
A [blank_start]dynamic link library[blank_end] is a library that contains functions and code that can be used by more than one program at a time.
Answer
  • dynamic link library
  • direct link library
  • class
  • namespace

Question 86

Question
When building a class library, you are building an assembly which contains DLLs.
Answer
  • True
  • False

Question 87

Question
The [blank_start]StringBuilder[blank_end] class represents a mutable string of characters.
Answer
  • StringBuilder
  • Builder
  • String
  • CharArray

Question 88

Question
A [blank_start]partial class[blank_end] is used when a class definition is very large and not everything can be reasonably stored in a single class file.
Answer
  • partial class
  • child class
  • extended class
  • sibling class

Question 89

Question
[blank_start]Enum[blank_end] is used to declare a list of named integer constants.
Answer
  • Enum
  • struct
  • IEnumerable
  • IntGroup

Question 90

Question
You can assign a null to int.
Answer
  • True
  • False

Question 91

Question
a [blank_start]constant[blank_end] is defined at the time of declaration and cannot be changed whereas a a [blank_start]readonly[blank_end] field can be changed at runtime inside a non-static constructor.
Answer
  • constant
  • readonly
  • readonly
  • constant

Question 92

Question
Every class in C# is derived from the base class named Object.
Answer
  • True
  • False

Question 93

Question
C#' s strong typing resolves at runtime.
Answer
  • True
  • False

Question 94

Question
An explicit conversion should be done when there is a risk that an implicit conversion would lost information.
Answer
  • True
  • False

Question 95

Question
Unit testing is done by both developer and testers.
Answer
  • True
  • False

Question 96

Question
The [blank_start]arrange[blank_end] section of a unit test method initializes objects and sets the value of the data that is passed to the method under test.
Answer
  • arrange
  • act
  • assert

Question 97

Question
The [blank_start]act[blank_end] section of unit testing invokes the method under test with the arranged parameters.
Answer
  • act
  • assert
  • arrange

Question 98

Question
The [blank_start]assert[blank_end] section of a unit test verifies that the action of the method under test behaves as expected.
Answer
  • assert
  • arrange
  • act

Question 99

Question
The [blank_start]is[blank_end] operator is used to check if the run-time type of an object is compatible with the given type or not whereas [blank_start]as[blank_end] operator is used to perform conversion between compatible reference types or Nullable types.
Answer
  • is
  • as
  • as
  • is

Question 100

Question
The keyword [blank_start]volatile[blank_end] ensures that all threads operating on an object will receive the latest value of the object when they receive it.
Answer
  • volatile
  • variable
  • changeable
  • recent

Question 101

Question
Which of the following are generic types?
Answer
  • List
  • Dictionary
  • Hashset
  • ArrayList
  • BitArray

Question 102

Question
Which of the following are non-generic types?
Answer
  • ArrayList
  • BitArray
  • List
  • Dictionary
  • Hashset

Question 103

Question
Generic collections hold elements of the same datatype.
Answer
  • True
  • False

Question 104

Question
Non-generic collections hold elements of the same datatype.
Answer
  • True
  • False

Question 105

Question
There are 3 types of collections in C#.
Answer
  • True
  • False

Question 106

Question
The process of converting a value type to a reference type is called [blank_start]boxing.[blank_end]
Answer
  • boxing

Question 107

Question
A [blank_start]value type[blank_end] stores the value in its memory space whereas a [blank_start]reference type[blank_end] stores the address of the value.
Answer
  • value type
  • reference type
  • reference type
  • value type

Question 108

Question
The namespace for generics is
Answer
  • system.collections.generic
  • system.collections
  • system.generic

Question 109

Question
int[1, 2, 3,] marks; is the correct way to declare an integer array
Answer
  • True
  • False

Question 110

Question
int[] marks = new int[10] is will declare an integer array that can hold 10 values.
Answer
  • True
  • False

Question 111

Question
IEnumerable<T> is an interface which supports iteration of a collection of a [blank_start]specified type.[blank_end]
Answer
  • specified type.
  • unspecified type

Question 112

Question
IEnumerable<T> is an interface that defines methods to manipulate generic collections.
Answer
  • True
  • False

Question 113

Question
If using multiple catch blocks, the most specific exception should be caught first.
Answer
  • True
  • False

Question 114

Question
[blank_start]LINQ[blank_end] is the name for a set of technologies that integrates query capabilities directly into the C# langauge.
Answer
  • LINQ
  • Q.U.E.R.Y.
  • LINK
  • LINKED

Question 115

Question
A destructor for an object can be declared by placing a _____ in front of the destructor name
Answer
  • ~
  • `
  • -
  • +

Question 116

Question
SOLID stands for Single Responsibility Principle, Open closed Principle, Liskov substitution Principle, Interface Segregation Principle, Dependency Integration Principle
Answer
  • True
  • False

Question 117

Question
A private constructor is used to ensure that a class [blank_start]_____[blank_end]
Answer
  • cannot be instantiated
  • must be instantiated
  • may be instantiated

Question 118

Question
The Single Responsibility Principle states that a class [blank_start]____________[blank_end]
Answer
  • should only have one purpose
  • needs methods that perform one task
  • should only have one method
  • should only have one constructor

Question 119

Question
The Open-Closed Principle states that a Software Entity should be open for [blank_start]extension[blank_end] but closed to [blank_start]modification[blank_end].
Answer
  • extension
  • modification
  • modification
  • extension

Question 120

Question
The Liskov substitution principle states that given a specific base class, any class that inherits from it can be a substitute for the base class.
Answer
  • True
  • False

Question 121

Question
The Interface Segregation Principle suggests that [blank_start]having many specific interfaces[blank_end] is the best design.
Answer
  • having many specific interfaces
  • having one large interface
  • having many abstract classes
  • having many different classes

Question 122

Question
The [blank_start]Dependency Inversion Principle[blank_end] states that code should depend upon abstractions, not concrete implementations.
Answer
  • Dependency Inversion Principle
  • Single Responsibility Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Open-Closed Principle

Question 123

Question
A class should inherit everything from its base class and, if necessary, override any of those inherited methods if something needs to be changed. This is an example of _________.
Answer
  • Open-Closed Principle
  • Single Responsibility Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

Question 124

Question
What does REST stand for?
Answer
  • Representational State Transfer
  • Resolved State Transfer
  • Representational Status Transfer
  • Representational State Transmission

Question 125

Question
REST is loosely coupled.
Answer
  • True
  • False

Question 126

Question
REST is stateless.
Answer
  • True
  • False

Question 127

Question
REST can deliver data in multiple formats such as HTML, XML, JSON, YAML, etc.
Answer
  • True
  • False

Question 128

Question
What does SOAP stand for?
Answer
  • Simple Object Access Protocol
  • Standard Object Access Protocol
  • Simple Object Abstraction Protocol
  • Simple Object Access Program

Question 129

Question
SOAP can return data in many formats such as XML, JSON, or HTML.
Answer
  • True
  • False

Question 130

Question
Which of the following are components of a SOAP message?
Answer
  • Envelope
  • Header
  • Body
  • Fault
  • Message
  • Metadata

Question 131

Question
[blank_start]SOAP[blank_end] is a standardized protocol with pre-defined rules to follow.
Answer
  • SOAP
  • REST

Question 132

Question
[blank_start]REST[blank_end] is an architectural style with loose guideline recommendations.
Answer
  • REST
  • SOAP

Question 133

Question
[blank_start]SOAP[blank_end] can be stateful or stateless and [blank_start]REST[blank_end] is stateless.
Answer
  • SOAP
  • REST
  • REST
  • SOAP

Question 134

Question
[blank_start]SOAP[blank_end] is more secure than [blank_start]REST[blank_end].
Answer
  • SOAP
  • REST
  • REST
  • SOAP

Question 135

Question
REST would be more appropriate for enterprise environments.
Answer
  • True
  • False

Question 136

Question
[blank_start]Action[blank_end] delegates take no parameters and return nothing (they are void). [blank_start]Func[blank_end] delegates should be used if you are expecting return values. [blank_start]Predicate[blank_end] functions are a delegate or anonymous function which returns a boolean.
Answer
  • Action
  • Func
  • Predicate
  • Func
  • Action
  • Predicate
  • Predicate
  • Action
  • Func

Question 137

Question
A Tuple is a structure that contains a sequence of elements of different data types that can be used if you need to store an object with properties but don't want to create a separate type for it.
Answer
  • True
  • False

Question 138

Question
A Tuple can hold a maximum of [blank_start]8[blank_end] elements
Answer
  • 8
  • 7
  • 4
  • 5
  • 6
  • 10

Question 139

Question
A nested class can be instantiated separately from its parent class.
Answer
  • True
  • False

Question 140

Question
A nested class can be declared private such that it can only be seen by its parent class and other nested classes of the parents.
Answer
  • True
  • False

Question 141

Question
A stack has an [blank_start]add[blank_end] and get method.
Answer
  • add

Question 142

Question
A stack is First In Last Out
Answer
  • True
  • False

Question 143

Question
A Queue is First In First Out.
Answer
  • True
  • False
Show full summary Hide full summary

Similar

Programming in C# Exam 70-483 Q&A
Richard Brown
Programming Goals: Creating a Learning Map for C#
Garrett Fortner
C# - Test Drive...!!
Prashant Singh R
C# Fundamentals
Robert Mulpeter
Introduction to Programming: C#
Isaiah Parker
Programming in C#: Exam 483
R M
C# Code Analysis Engine Developer - Can you do my job?
Hugh Wood
.NET midterm question
BigDady313 .