Dhaka Power Distribution Company Limited
Post: Technical (Computer technology)
Subject code: 155; Mark: 80
#include
int main() {
int n = 4;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++) {
printf(" ");
}
for (int j = 1; j <= i; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
The output is:
*
**
***
****
**Explanation:**
* `i = 1` → 3 spaces + 1 `*`
* `i = 2` → 2 spaces + 2 `*`
* `i = 3` → 1 space + 3 `*`
* `i = 4` → 0 spaces + 4 `*`
Concept: Inheritance
In Object-Oriented Programming (OOP), Inheritance is a mechanism where one class, called the Derived Class, acquires the properties and methods of another class, called the Base Class. The Derived Class can also have some additional features of its own.
Example:
#include <iostream>
using namespace std;
class C {
public:
void feature1() {
cout << "Feature of Class C" << endl;
}
};
class D : public C {
public:
void feature2() {
cout << "Extra feature of Class D" << endl;
}
};
int main() {
D obj;
obj.feature1(); // Inherited from Class C
obj.feature2(); // Own feature of Class D
return 0;
}Here, Class D inherits the feature of Class C and also has its own additional feature. Therefore, the concept used here is Inheritance.
Solution:
Given, A = {1, 2, 3, 4, 5, 6, 7, 8}.
We need to select five integers from A and prove that at least one pair of selected integers has a sum of 9.
The numbers in A can be divided into the following four pairs, where each pair has a sum of 9:
(1, 8), (2, 7), (3, 6), (4, 5)
Here, the 4 pairs are the pigeonholes.
When 5 integers are selected, they are the pigeons.
By the Pigeonhole Principle, if 5 pigeons are placed into 4 pigeonholes, then at least one pigeonhole must contain at least 2 pigeons.
Therefore, at least one of the four pairs must have both of its integers selected.
Each pair has a sum of 9. Hence, at least one pair of selected integers has a sum of 9.
Therefore, proved by the Pigeonhole Principle.

Example of a Trigger A Trigger is a database program that automatically executes when a specified event, such as INSERT, UPDATE, or DELETE, occurs on a table. Example: The following trigger automatically records the date and time whenever a new employee is inserted into the Employee table.
CREATE TRIGGER employee_insert
AFTER INSERT ON Employee
FOR EACH ROW
BEGIN
INSERT INTO Employee_Log(employee_id, log_date)
VALUES (NEW.employee_id, NOW());
END;Here, the trigger employee_insert automatically executes after a new record is inserted into the Employee table and stores the employee ID and insertion time in the Employee_Log table.
SELECT c.customerID, c.name, SUM(o.orderAmount) AS total_order_amount FROM Customer c JOIN Accounts a ON c.customerID = a.customerID JOIN Orders o ON a.accountID = o.accountID GROUP BY c.customerID, c.name HAVING SUM(o.orderAmount) > 5000;

2 thoughts on “DPDC, Assistant Engineer(ICT), 2025”
Answer gula Add korian
Added