csharp_introduction_quiz.md - brainchildservices/curriculum GitHub Wiki
-
What
//
indicates?A:
//
indicates the beginning of a comment in C# -
Why class is mandatory for C#?
A: C# is an object-oriented programming language, creating a class is mandatory for the program’s execution.
-
Why it is mandatory for a C# program to have a Main() method.
A: The execution of every C# program starts from the Main() method. so it is mandatory.
-
What is a variable?
A: Variables are containers for storing data values.
-
What is a variable?
A: A variable is a name given to a storage area that is used to store values of various data types.
-
How to declare a variable?
A: To create a variable, you must specify the type and assign it a value: type variableName = value;
-
What a datatype specifies?
A: A data type specifies the size and type of variable values.
-
How a value type is different from reference type?
A: A data type is a value type if it holds a data value within its own memory space.It means the variables of these data types directly contain values. A reference type doesn't store its value directly. Instead, it stores the address where the value is being stored.
-
Explain Reference Type?
A: A Reference type contains a pointer to another memory location that holds the data.
-
what is C# null?
A: The default value of a reference type variable is null when they are not initialized. Null means not refering to any object.
-
What is nullable type?
A: C# 2.0 introduced nullable types, using which you can assign null to a value type variable or declare a value type variable without assigning a value to it.
-
What is C# Expressions?
A: An expression is a sequence of one or more operands and zero or more operators that can be evaluated to a single value, object, method, or namespace.
-
What are examples for Operators and Operands?
A: Examples of operators include +, -, *, /, and new. Examples of operands include literals, fields, local variables, and expressions.
-
What is a C# Statement?
A: A statement is a basic unit of execution of a program. A program consists of multiple statements.
-
What is a Declaration Statement?
A: Declaration statements are used to declare and initialize variables.
-
What is an Expression Statement?
A: An expression followed by a semicolon is called an expression statement.
-
What is compilation process?
A: The compilation is a process of converting the source code into object code.
-
WHAT IS A COMPILER?
A: A compiler is a program that transforms source code written in one programming language into another programming language.
When you run the C# compiler, it takes your code as an input, does some processing, and then outputs your program in intermediate language (IL) code which is saved in *.exe or *.dll files.
-
WHAT ARE COMPILED ERRORS?
A: Compiler errors are found by the C# compiler and prevent your code from being compiled into a .exe. Some common examples of compiler errors are missing semicolons or misspelled commands.
-
WHAT IS A RUNTIME ERROR?
A: Runtime errors occur if an issue is encountered while the program is running. These are usually serious errors that the runtime halts at because continuing could impact other files or the operating system. Possible runtime errors include a program trying to divide by zero or writing to a read-only file.