What are imperative programming constructs?
Imperative programming constructs are statements or commands in a programming language that are used to control the flow of execution and perform operations on data. They are used to express the logic of the program in a step-by-step manner
Give examples of imperative programming constructs in C#.
What is static type-checking?
It is a process that checks the type of the program during compile time.
The compiler checks whether the types of all variables, functions, and expressions in the program are compatible and will work correctly at runtime.
What are the advantages of static type-checking?
What are the disadvantages of static type-checking?
What is dynamic type-checking?
It is a process that checks the type of the program during runtime. In a dynamically typed language, the type of a variable or expression is determined at runtime, and the runtime checks if the types are compatible before executing the code.
What are the advantages of dynamic type-checking?
What are the disadvantages of dynamic type-checking?
Is C# a static or dynamic type-checking language?
It is a statically typed language, which means that types are checked at compile-time rather than runtime.
What is a strongly-typed language?
It requires that all variables have a declared type and that the operations performed on them are consistent with that type.
This means that type errors are caught at compile-time, preventing potential runtime errors
What are the advantages of strongly-typed languages?
It helps catch errors at compile-time, which can save time and effort in debugging.
It also allows for better code optimization and can improve performance.
What are the disadvantages of strongly-typed languages?
It can be restrictive and can lead to more verbose code.
Give examples of strongly-typed programming languages
What does weakly-typed languages allow?
They allow type coercion.
What does type coercion mean?
It means that a variable can change its type from one to another as needed. This can lead to errors and bugs that may only surface at runtime.
Give examples of weakly-typed programming languages
What are the advantages of weakly-typed languages?
It allows for more flexibility and can make code shorter and more concise.
It can also be easier to write code quickly and iterate rapidly.
What are the disadvantages of weakly-typed languages?
It can lead to errors that may be difficult to track down, and can potentially cause security issues if not handled properly.
Does C# have primitives?
C# has no primitives, everything is typed.
The compiler allows you to write certain objects in a native way, such as int, bool, and string.
What is the equivalent of the primitive ‘int’ in C#?
The equivalent of the primitive ‘int’ in C# is System.Int32.
What is the equivalent of the primitive ‘bool’ in C#?
The equivalent of the primitive ‘bool’ in C# is System.Boolean.
What is the equivalent of the primitive ‘string’ in C#?
The equivalent of the primitive ‘string’ in C# is System.String.
How does the compiler handle types in C#?
Types can be deduced by the compiler and operated on using methods. The compiler accepts a native usage of operands.
What is the JIT compiler in C#?
It stands for “Just-In-Time” compiler, which allows the compiler to rewrite to native code, and hence optimize number types.