C# Training Flashcards

1
Q

what is C#

A

C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is C# based on?

A

C# is based on object oriented programming concepts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are the object oriented programming concepts (OOP)?

A
  • Class
  • Inheritance
  • Object
  • Abstraction
  • Encapsulation
  • Polymorphism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe a class

A
  • -A class is a blueprint for any functional entity which defines its properties and its functions.
  • -Here we can take Human Being as a class. Human Being, having body parts like hands, legs, eyes etc, which are its properties and performing various actions like walk, talk, eat, see etc, which are its functions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe inheritance

A
  • -Inheritance enables new objects to take on the properties of existing objects. A class that is used as the basis for inheritance is called a super-class or base class. A class that inherits from a super-class is called a subclass or derived class.
  • -Considering Human Being a class, which has properties like hands, legs, eyes etc, and functions like walk, talk, eat, see etc. Male and Female are also classes, but most of the properties and functions are included in Human Being, hence they can inherit everything from class Human Being using the concept of Inheritance.
  • -Therefore Male and Female are considered a subclass or derived class since they can inherit everything from the Human Being class. While the Human Being can be considered a super-class or base class because it is used as a basis of inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe object

A
  • -Objects are the physical representation of classes meanwhile classes are just a logical definition.
    • My name is Ronald, and I am an instance/object of class Male. When we say, Human Being, Male or Female, we just mean a kind, you, your friend, me, we are the forms of these classes. We have a physical existence while a class is just a logical definition. We are the objects.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe Abstraction

A
  • -Abstraction means, showcasing only the required things to the outside world while hiding the details.
  • -Continuing our example, Human Being’s can talk, walk, hear, eat, but the details are hidden from the outside world. We can take our skin as the Abstraction factor in our case, hiding the inside mechanism.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe encapsulation

A
    • Encapsulation means that we want to hide unnecessary details from the user.
  • -For example, when we call from our mobile phone, we select the number and press call button. But the entire process of calling is hidden from us
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is polymorphism

A

Polymorphism is a concept, which allows us to redefine the way something works, by either changing how it is done or by changing the parts using which it is done. Both the ways have different terms for them called Overriding and Overloading respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is Overloading

A

This is a type of polymorphism which allows us to change the way something works by changing the parts used in getting things done.
–For example, If we walk using our hands, and not legs, here we will change the parts used to perform something (walking). Hence this is called Overloading.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Overriding

A
  • -This is a type of polymorphism which allows us to change the way something works by changing how it is done.
  • -For example, if there is a defined way of walking, but I wish to walk differently, but using my legs, like everyone else. Then I can walk like I want, this will be called as Overriding.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is C# a widely used programming language

A

 It is a modern, general-purpose programming language
 It is object oriented.
 It is component oriented.
 It is easy to learn.
 It is a structured language.
 It produces efficient programs.
 It can be compiled on a variety of computer platforms.  It is a part of .Net Framework.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the ,Net Framework

A

The .Net framework is a revolutionary platform that helps you to write applications. These .Net framework applications are multi-platform applications. The framework has been designed in such a way that it can be used from any of the following languages: C#, C++, Visual Basic, Jscript, COBOL, etc. All these languages can access the framework as well as communicate with each other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which applications can be written using the .Net Framework

A

 Windows applications
 Web applications
 Web services

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what are some of the components of the .Net Framewor

A
 Common Language Run-time (CLR) 
 The .Net Framework Class Library 
 Common Language Specification 
 Common Type System 
 Metadata and Assemblies 
 Windows Forms 
 ASP.Net and ASP.Net AJAX 
 ADO.Net 
 Windows Workflow Foundation (WF) 
 Windows Presentation Foundation 
 Windows Communication Foundation (WCF) 
 LINQ
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the parts a C# program consists of

A
 Namespace declaration 
 A class 
 Class methods 
 Class attributes 
 A Main method 
 Statements and Expressions 
 Comments
17
Q

Here is a small program of C#:

using System; 
namespace HelloWorldApplication 
{ 
   class HelloWorld 
   { 
      static void Main(string[] args) 
      { 
         /* my first program in C# */ 
         Console.WriteLine("Hello World"); 
         Console.ReadKey(); 
      } 
   } 
} 

Let us look at the various parts of the given program:

A

 The first line of the program using System; - the using keyword is used to include the System namespace in the program. A program generally has multiple using statements.
 The next line has the namespace declaration. A namespace is a collection of classes. The “HelloWorldApplication” namespace contains the class HelloWorld.
 The next line has a class declaration, the class “HelloWorld” contains the data and method definitions that your program uses. Classes generally contain multiple methods. Methods define the behavior of the class. However, the HelloWorld class has only one method Main.
 The next line defines the Main method, which is the entry point for all C# programs. The Main method states what the class does when executed.
 The next line // is ignored by the compiler and it is put to add comments in the program.
 The Main method specifies its behavior with the statement Console.WriteLine(“Hello World”);
“WriteLine” is a method of the Console class defined in the System namespace. This statement causes the message “Hello, World!” to be displayed on the screen.

18
Q

what is worth noting about C#

A

 C# is case sensitive.
 All statements and expression must end with a semicolon (;).
 The program execution starts at the Main method.