Palli Sanchay Bank Programmer Written Test: 2018প্রশ্ন ও সমাধান
- Set by
- Palli Sanchay Bank
- Post
- Programmer
- Exam date
- 2018
- Questions
- 6 (0 MCQ, 6 written)
- Exam guide
- Bank IT jobs · ব্যাংকের আইটি চাকরি
- Programming · প্রোগ্রামিং 3
- Algorithms · অ্যালগরিদম 1
- Database · ডেটাবেজ 1
- Software Engineering · সফটওয়্যার ইঞ্জিনিয়ারিং 1
Explain feature of OOP.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Find the output of following program.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Define weak Entity? What are the difference between primary key and super key?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is main difference Destructor and constructor with example?
Model answer
| Destructor | Constructor | |
|---|---|---|
| Invoked when | An object is destroyed (goes out of scope / deleted) | An object is created (instantiated) |
| Name | Same as class name, prefixed with ~ (C++) |
Same as class name, no prefix |
| Arguments | Never takes arguments, cannot be overloaded | Can take arguments, can be overloaded (multiple versions) |
| Count per class | Exactly one | Can be more than one (overloaded) |
| Purpose | Releases/frees resources (memory, file handles, connections) | Allocates/initialises resources and sets initial state |
| Called | Automatically, exactly once per object's lifetime | Automatically, once per object creation |
Example (C++):
#include <iostream>
using namespace std;
class FileHandler {
public:
FileHandler() { // constructor: acquire resource
cout << "File opened\n";
}
~FileHandler() { // destructor: release resource
cout << "File closed\n";
}
};
int main() {
FileHandler f; // constructor runs: "File opened"
cout << "Working with file...\n";
return 0; // destructor runs automatically: "File closed"
}
Output:
File opened
Working with file...
File closed
Exam takeaway: constructor = resource acquisition at birth (overloadable, takes arguments); destructor = resource release at death (single, no arguments) — together they implement the RAII (Resource Acquisition Is Initialization) pattern in C++.
Write Algorithm of Fibonacci series.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between black box and white box testing.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Question text is from the public recruitment exam; answers and explanations are written by ARBS Academy. All past papers · Bank IT jobs guide