BKSP Assistant Programmer Exam: 03.12.2022প্রশ্ন ও সমাধান
- Set by
- BKSP
- Post
- Assistant Programmer
- Exam date
- 3 Dec 2022
- Questions
- 6 (0 MCQ, 6 written)
- Exam guide
- Government IT officer posts · সরকারি প্রতিষ্ঠানের আইটি পদ
- Programming · প্রোগ্রামিং 3
- Cyber Security · সাইবার নিরাপত্তা 2
- Database · ডেটাবেজ 1
Write a program to find this is Leap year or not, using function.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between encryption and hashing.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Write down the main feature of Object Oriented Programming (OOP).
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is RAID?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is Vulnerability?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Define Class and Object in C++ with example.
Model answer
Direct answer: A class is a user-defined blueprint/template that groups data members (attributes) and member functions (behavior); an object is a concrete instance of that class, occupying actual memory with its own copy of the data members.
#include <iostream>
using namespace std;
class Box { // class = blueprint
public:
double length, breadth, height;
double volume() {
return length * breadth * height;
}
};
int main() {
Box b1; // b1 = object (instance of Box)
b1.length = 5; b1.breadth = 3; b1.height = 2;
cout << "Volume: " << b1.volume() << endl; // Volume: 30
return 0;
}
classDiagram
class Box {
+double length
+double breadth
+double height
+volume() double
}
Key distinction:
- The class
Boxitself occupies no memory for data until an object is created. b1is an object — it has real memory holding actual length/breadth/height values, and can callvolume()on those specific values.- Multiple objects (
b1,b2, ...) can be created from the same class, each with independent data.
Exam takeaway: Class = definition/type (no memory for its own data); Object = instance of that class (has real memory and state) — "a class is to an object what a blueprint is to a house."
Question text is from the public recruitment exam; answers and explanations are written by ARBS Academy. All past papers · Government IT officer posts guide