Palli Sanchay Bank Programmer Exam 2018 — Question Solution | পল্লী সঞ্চয় ব্যাংক প্রোগ্রামার নিয়োগ পরীক্ষা ২০১৮ — প্রশ্ন সমাধান
- Palli Sanchay Bank
- Programmer
- 2018
- 6 questions · 0 MCQ, 6 written
Page updated
ARBS Academy · itjobs.arbsacademy.com
About this exam paper · প্রশ্নপত্র পরিচিতি
The Palli Sanchay Bank Programmer exam was held in 2018. The paper had 6 written questions. The subjects asked most were Programming (3), Algorithms (1) and Database (1). This page lists every question, with 1 answered and explained; the rest of the answers open with a free ARBS Academy account, where the paper can also be practised as a timed test.
পল্লী সঞ্চয় ব্যাংক প্রোগ্রামার নিয়োগ পরীক্ষার (২০১৮) এই প্রশ্নপত্রে ৬টি প্রশ্ন ছিল, বেশিরভাগ প্রোগ্রামিং ও অ্যালগরিদম থেকে। এখানে ১টি প্রশ্নের ব্যাখ্যাসহ উত্তর দেওয়া আছে; বাকিগুলো ফ্রি অ্যাকাউন্টে খোলে।
- Organisation
- Palli Sanchay Bank
- Post
- Programmer
- Exam date
- 2018
- Questions
- 6 (0 MCQ, 6 written)
- Exam guide
- Bank IT jobs · ব্যাংকের আইটি চাকরি
Explain feature of OOP.
Find the output of following program.
i)
int main() {
char str[120]= "Digital Bangladesh";
int n;
n = strlen(str);
str[4] = '\0';
printf("%s",str);
return 0;
}
ii)
int main() {
int i;
for (i=0; i<5; i++) {
if (i==3)
continue;
printf("%d\n",i);
}
return 0;
}
Define weak entity. What are the differences between primary key and super key?
Sign up free to see the model answers to written questions 1–3 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is the main difference between destructor and constructor? Explain with example.
Model answer
Constructor: a special member function that runs automatically when an object is created. Its job is to initialise the object.
Destructor: a special member function that runs automatically when an object's lifetime ends. Its job is to release what the object holds (memory, files, connections).
Main differences (C++)
| Point | Constructor | Destructor |
|---|---|---|
| Purpose | Initialises data members and acquires resources | Cleans up and releases resources |
| When it runs | When an object is created (definition, or new) |
Local object: at the end of its block. new object: only when delete is called. Global/static object: at program end |
| Name | Same as the class: Buffer(...) |
Class name with a tilde: ~Buffer() |
| Parameters | Can take parameters (default, parameterised, copy) | Takes no parameters |
| Overloading | Can be overloaded; a class can have several | Cannot be overloaded; only one per class |
| Return type | None, not even void |
None |
virtual |
Cannot be virtual | Can be, and should be in a polymorphic base class |
| Order | Base part first, then derived part | Reverse: derived part first, then base part. Local objects in one scope are destroyed in reverse order of creation |
Example (C++11):
#include <iostream>
#include <string>
using namespace std;
class Buffer {
string tag;
int *cells;
int size;
public:
Buffer(const string &t, int n) : tag(t), size(n) { // constructor
cells = new int[size];
cout << "Constructor: " << tag << " allocated " << size << " ints\n";
}
Buffer(const Buffer &) = delete; // no copying:
Buffer &operator=(const Buffer &) = delete; // one owner per array
~Buffer() { // destructor
delete[] cells;
cout << "Destructor: " << tag << " released\n";
}
};
int main() {
Buffer first("A", 4);
{
Buffer second("B", 8);
cout << "Inner block ends\n";
} // B destroyed here
Buffer *third = new Buffer("C", 2);
delete third; // C destroyed only by delete
Buffer last("D", 3);
cout << "main ends\n";
return 0; // D, then A destroyed
}
Output:
Constructor: A allocated 4 ints
Constructor: B allocated 8 ints
Inner block ends
Destructor: B released
Constructor: C allocated 2 ints
Destructor: C released
Constructor: D allocated 3 ints
main ends
Destructor: D released
Destructor: A released
What the output shows:
- The constructor is parameterised (
tag,n) and allocates memory. The destructor has no parameters and frees that memory withdelete[]. Bis destroyed as soon as its inner block ends.Cwas created withnew, so its destructor runs only atdelete third;. If that line is removed, "Destructor: C released" is never printed and the memory leaks.Dis destroyed beforeA: reverse order of creation.- The copy constructor and copy assignment are deleted (C++11
= delete), so two objects can never free the same array.
Rules the compiler enforces (g++): ~Buffer(int x) gives "destructors may not have parameters". A second ~Buffer() gives "cannot be overloaded". virtual Buffer() gives "constructors cannot be declared 'virtual'". If a derived object is deleted through a base-class pointer and the base destructor is not virtual, the behaviour is undefined, so a base class meant for polymorphism needs a virtual destructor.
In other languages: Java has constructors but no destructors. The garbage collector frees memory, and finalize() has been deprecated for removal since Java 18 (JEP 421), so resources are closed with close() and try-with-resources. In C#, ~Name() is a finalizer: the garbage collector calls it at an unpredictable time.
Exam tip: constructor = set-up at creation (same name, may take arguments, can be overloaded); destructor = clean-up at end of life (~ name, no arguments, one per class, runs in reverse order).
Write Algorithm of Fibonacci series.
Difference between black box and white box testing.
Sign up free to see the model answers to written questions 5–6 · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Explanations © ARBS Academy
Keep going with a free account · ফ্রি অ্যাকাউন্টে যা যা করতে পারবেন
5 more answers from this paper open with a free account.
এই প্রশ্নপত্রের আরও ৫টি উত্তর, ধাপে ধাপে ব্যাখ্যাসহ, ফ্রি অ্যাকাউন্টে খুলবে।
Free account · 1 day of Premium free
Paper analysis · প্রশ্নপত্র বিশ্লেষণ
Its questions come from 5 syllabus chapters; the biggest is Object-Oriented Programming, in Programming, with 2 questions. Object-Oriented Programming is asked in 88 other papers too (2015–2026).
Its biggest topics · প্রধান টপিক
Questions in this paper, and how many of our other papers ask the topic
- Object-Oriented Programming Programming · 88 other papers, 2015–20262
- Language Basics & Syntax Programming · 122 other papers, 2015–20261
- ER Model & Design Database · 101 other papers, 2015–20261
- Testing & Quality Software Engineering · 52 other papers, 2016–20261
- Complexity & Analysis Algorithms · 26 other papers, 2016–20251
From our own past papers: each question filed under one syllabus chapter. Practice and held questions are not counted.
Questions about this paper · সাধারণ প্রশ্ন
- How many questions were in the Palli Sanchay Bank Programmer exam (2018)?
- 6 written questions.
- Which subjects were asked most in the Palli Sanchay Bank Programmer exam (2018)?
- Programming (3), Algorithms (1) and Database (1), out of 6 questions.
- When was the Palli Sanchay Bank Programmer exam held?
- In 2018. The exact day isn't in our records.
- Where can I find the Palli Sanchay Bank Programmer exam (2018) question solution?
- On this page: 1 of the 6 questions are shown with worked answers. The rest of the answers open with a free ARBS Academy account, where the paper can also be practised as a timed test.
Question text is from the public recruitment exam; answers and explanations are written by ARBS Academy. All past papers