ADO.NET and C# Programming Flashcards

1
Q

Write a code line to add a Namespace to use SQL Server Provider.

A

using System.Data.SqlClient;

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

Name other two (2) database Providers apart from SQL Server Provider.

A

OracleClient
OLE DB

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

Name any two (2) basic components of ADO.NET.

A

Connection: Manages the connection to the database.
Command: Executes SQL commands against the database.

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

Describe a class constructor in C# programming language.

A

A class constructor is a special method with the same name as the class, used to initialize the object’s state when an instance of the class is created. It may take parameters, and its purpose is to set up the initial values of the class’s properties or perform other necessary setup tasks.

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

A class Product has properties: Code and Price. Write a code snippet for the constructor of the class Product to initialize the properties with values passed as parameters. (No need to define properties).

A

public class Product
{
public string Code { get; set; }
public decimal Price { get; set; }

// Constructor
public Product(string code, decimal price)
{
    Code = code;
    Price = price;
} }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Illustrate the following class relationships with well-labeled diagrams.

A

i. Associations between class Manager and Class Department.

ii. Aggregation between class Engine and class Car.

iii. Generalization between class Fish and class Animal.

iv. Composition between class Department and class Company.

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