WBSSC SLST Computer Science IX & XN : Programming Languages & Concepts

100 MCQs on Programming Concepts

1. Which of the following is a procedural programming language?

১. নিচের কোনটি একটি প্রসিডিউরাল প্রোগ্রামিং ল্যাঙ্গুয়েজ?

  • A) Java
  • B) C++
  • C) C
  • D) Python

Correct Answer: C) C

Explanation: C is a classic example of a procedural language, where programs are organized around procedures or functions. Java, C++, and Python are primarily object-oriented, although they support procedural paradigms.

ব্যাখ্যা: C একটি প্রসিডিউরাল ল্যাঙ্গুয়েজের ক্লাসিক উদাহরণ, যেখানে প্রোগ্রামগুলি প্রসিডিউর বা ফাংশনকে কেন্দ্র করে সাজানো হয়। Java, C++ এবং Python মূলত অবজেক্ট-ওরিয়েন্টেড, যদিও তারা প্রসিডিউরাল ধারণাকেও সমর্থন করে।

2. What does OOP stand for?

২. OOP-এর পূর্ণরূপ কী?

  • A) Object-oriented Protocol
  • B) Object-oriented Programming
  • C) Open-source Object Programming
  • D) Original Object Paradigm

Correct Answer: B) Object-oriented Programming

Explanation: OOP stands for Object-Oriented Programming, a programming paradigm based on the concept of “objects”, which can contain data and code.

ব্যাখ্যা: OOP-এর পূর্ণরূপ হলো অবজেক্ট-ওরিয়েন্টেড প্রোগ্রামিং, যা “অবজেক্ট” ধারণার উপর ভিত্তি করে একটি প্রোগ্রামিং প্যারাডাইম। এই অবজেক্টগুলিতে ডেটা এবং কোড উভয়ই থাকতে পারে।

3. In C++, which keyword is used to create a new object (instance of a class)?

৩. C++ এ, একটি নতুন অবজেক্ট (ক্লাসের ইনস্ট্যান্স) তৈরি করতে কোন কীওয়ার্ড ব্যবহার করা হয়?

  • A) new
  • B) create
  • C) object
  • D) instance

Correct Answer: A) new

Explanation: The `new` keyword in C++ is used to dynamically allocate memory for an object and returns a pointer to that object.

ব্যাখ্যা: C++ এ `new` কীওয়ার্ডটি ডাইনামিকভাবে একটি অবজেক্টের জন্য মেমরি বরাদ্দ করতে ব্যবহৃত হয় এবং সেই অবজেক্টের একটি পয়েন্টার রিটার্ন করে।

4. Which of the following is NOT a fundamental data type in C?

৪. নিচের কোনটি C-এর একটি মৌলিক ডেটা টাইপ নয়?

  • A) int
  • B) float
  • C) string
  • D) char

Correct Answer: C) string

Explanation: C does not have a built-in `string` data type. Strings in C are implemented as an array of characters (`char[]`) terminated by a null character (`\0`).

ব্যাখ্যা: C-তে কোনো বিল্ট-ইন `string` ডেটা টাইপ নেই। C-তে স্ট্রিংগুলিকে ক্যারেক্টার অ্যারে (`char[]`) হিসেবে প্রয়োগ করা হয়, যা একটি নাল ক্যারেক্টার (`\0`) দ্বারা শেষ হয়।

5. The concept of wrapping data and functions into a single unit is called?

৫. ডেটা এবং ফাংশনগুলিকে একটি একক ইউনিটে আবদ্ধ করার ধারণাকে কী বলা হয়?

  • A) Inheritance
  • B) Polymorphism
  • C) Abstraction
  • D) Encapsulation

Correct Answer: D) Encapsulation

Explanation: Encapsulation is one of the fundamental principles of OOP. It refers to the bundling of data (attributes) and the methods (functions) that operate on the data into a single unit called a class.

ব্যাখ্যা: এনক্যাপসুলেশন হলো OOP-এর অন্যতম মৌলিক নীতি। এটি ডেটা (অ্যাট্রিবিউট) এবং সেই ডেটার উপর কাজ করে এমন মেথড (ফাংশন) গুলিকে একটি একক ইউনিটে (ক্লাস) একত্রিত করাকে বোঝায়।

6. What is the purpose of the `PRINT` statement in BASIC language?

৬. BASIC ভাষায় `PRINT` স্টেটমেন্টের উদ্দেশ্য কী?

  • A) To take input from the user
  • B) To display output on the screen
  • C) To declare a variable
  • D) To perform a calculation

Correct Answer: B) To display output on the screen

Explanation: In BASIC (Beginner’s All-purpose Symbolic Instruction Code), the `PRINT` statement is used to show text or the value of variables on the output screen.

ব্যাখ্যা: BASIC (বিগিনার্স অল-পারপাস সিম্বলিক ইন্সট্রাকশন কোড) এ, `PRINT` স্টেটমেন্টটি আউটপুট স্ক্রিনে টেক্সট বা ভেরিয়েবলের মান প্রদর্শন করতে ব্যবহৃত হয়।

7. A flowchart that outlines the main segments of a program is called a?

৭. একটি ফ্লোচার্ট যা একটি প্রোগ্রামের প্রধান অংশগুলির রূপরেখা দেয়, তাকে কী বলা হয়?

  • A) Micro flowchart
  • B) Macro flowchart
  • C) Detail flowchart
  • D) System flowchart

Correct Answer: B) Macro flowchart

Explanation: A macro flowchart provides a high-level overview of a program’s structure, showing the main modules and the flow of control between them, without going into the details of each module.

ব্যাখ্যা: একটি ম্যাক্রো ফ্লোচার্ট একটি প্রোগ্রামের কাঠামোর একটি উচ্চ-স্তরের চিত্র প্রদান করে, যা প্রতিটি মডিউলের বিস্তারিত বিবরণে না গিয়ে প্রধান মডিউল এবং তাদের মধ্যে নিয়ন্ত্রণের প্রবাহ দেখায়।

8. In C, what does `sizeof(int)` return?

৮. C-তে, `sizeof(int)` কী রিটার্ন করে?

  • A) The value of an integer
  • B) The memory address of an integer
  • C) The size of an integer in bytes
  • D) The maximum value an integer can hold

Correct Answer: C) The size of an integer in bytes

Explanation: The `sizeof` operator in C is a compile-time unary operator that returns the size, in bytes, of its operand. `sizeof(int)` returns the number of bytes allocated to store an integer, which can vary depending on the system architecture (e.g., 4 bytes on a 32-bit system).

ব্যাখ্যা: C-তে `sizeof` অপারেটরটি একটি কম্পাইল-টাইম ইউনারি অপারেটর যা তার অপারেন্ডের আকার বাইটে রিটার্ন করে। `sizeof(int)` একটি ইন্টিজার সংরক্ষণের জন্য বরাদ্দকৃত বাইটের সংখ্যা রিটার্ন করে, যা সিস্টেম আর্কিটেকচারের উপর নির্ভর করে পরিবর্তিত হতে পারে (যেমন, একটি 32-বিট সিস্টেমে 4 বাইট)।

9. Which data structure follows the LIFO (Last-In, First-Out) principle?

৯. কোন ডেটা স্ট্রাকচার LIFO (লাস্ট-ইন, ফার্স্ট-আউট) নীতি অনুসরণ করে?

  • A) Queue
  • B) Stack
  • C) Linked List
  • D) Tree

Correct Answer: B) Stack

Explanation: A stack is a linear data structure that follows the LIFO principle. The last element added to the stack is the first one to be removed. Think of a stack of plates.

ব্যাখ্যা: স্ট্যাক একটি লিনিয়ার ডেটা স্ট্রাকচার যা LIFO নীতি অনুসরণ করে। স্ট্যাকে যে উপাদানটি শেষে যোগ করা হয়, সেটিই প্রথমে সরানো হয়। এটি প্লেটের স্ট্যাকের মতো।

10. A function that calls itself is known as a?

১০. একটি ফাংশন যা নিজেকে কল করে, তাকে কী বলা হয়?

  • A) Recursive function
  • B) Inline function
  • C) Friend function
  • D) Virtual function

Correct Answer: A) Recursive function

Explanation: Recursion is a programming technique where a function calls itself directly or indirectly to solve a problem. It must have a base case to stop the recursion.

ব্যাখ্যা: রিকার্সন একটি প্রোগ্রামিং কৌশল যেখানে একটি ফাংশন কোনো সমস্যা সমাধানের জন্য প্রত্যক্ষ বা পরোক্ষভাবে নিজেকে কল করে। রিকার্সন থামানোর জন্য এটির একটি বেস কেস থাকা আবশ্যক।

11. What is a pointer in C/C++?

১১. C/C++ এ পয়েন্টার কী?

  • A) A variable that stores the value of another variable
  • B) A variable that stores the memory address of another variable
  • C) A special keyword for functions
  • D) A data type for storing decimal numbers

Correct Answer: B) A variable that stores the memory address of another variable

Explanation: A pointer is a special variable that is designed to store the memory address of another variable. It “points” to the location of the data in memory.

ব্যাখ্যা: পয়েন্টার হলো একটি বিশেষ ভেরিয়েবল যা অন্য একটি ভেরিয়েবলের মেমরি অ্যাড্রেস সংরক্ষণ করার জন্য ডিজাইন করা হয়েছে। এটি মেমরিতে ডেটার অবস্থানে “পয়েন্ট” করে।

12. Which of these allows a class to inherit properties from more than one class?

১২. নিচের কোনটি একটি ক্লাসকে একাধিক ক্লাস থেকে বৈশিষ্ট্য ইনহেরিট করার অনুমতি দেয়?

  • A) Single Inheritance
  • B) Multilevel Inheritance
  • C) Multiple Inheritance
  • D) Hierarchical Inheritance

Correct Answer: C) Multiple Inheritance

Explanation: Multiple inheritance is a feature of some object-oriented languages like C++ where a class can inherit attributes and methods from more than one parent class.

ব্যাখ্যা: মাল্টিপল ইনহেরিটেন্স C++ এর মতো কিছু অবজেক্ট-ওরিয়েন্টেড ল্যাঙ্গুয়েজের একটি বৈশিষ্ট্য, যেখানে একটি ক্লাস একাধিক প্যারেন্ট ক্লাস থেকে অ্যাট্রিবিউট এবং মেথড ইনহেরিট করতে পারে।

13. The `&` operator in C is used for?

১৩. C-তে `&` অপারেটরটি কীসের জন্য ব্যবহৃত হয়?

  • A) Value at address
  • B) Address of
  • C) Bitwise AND
  • D) Both B and C

Correct Answer: D) Both B and C

Explanation: The `&` symbol has two meanings in C. As a unary operator, it is the “address-of” operator (`&variable`). As a binary operator, it performs a bitwise AND operation (`a & b`).

ব্যাখ্যা: C-তে `&` চিহ্নের দুটি অর্থ রয়েছে। একটি ইউনারি অপারেটর হিসাবে, এটি “অ্যাড্রেস-অফ” অপারেটর (`&variable`)। একটি বাইনারি অপারেটর হিসাবে, এটি একটি বিটওয়াইজ AND অপারেশন (`a & b`) সম্পাদন করে।

14. Which concept allows a function or operator to have different meanings in different contexts?

১৪. কোন ধারণাটি একটি ফাংশন বা অপারেটরকে বিভিন্ন প্রসঙ্গে বিভিন্ন অর্থ ধারণ করার অনুমতি দেয়?

  • A) Encapsulation
  • B) Inheritance
  • C) Polymorphism
  • D) Abstraction

Correct Answer: C) Polymorphism

Explanation: Polymorphism, meaning “many forms,” allows the same interface (like a function name or operator) to be used for different underlying data types. Function overloading and operator overloading are examples of compile-time polymorphism.

ব্যাখ্যা: পলিমরফিজম, যার অর্থ “বহুরূপতা”, একই ইন্টারফেসকে (যেমন একটি ফাংশনের নাম বা অপারেটর) বিভিন্ন ডেটা টাইপের জন্য ব্যবহার করার অনুমতি দেয়। ফাংশন ওভারলোডিং এবং অপারেটর ওভারলোডিং হলো কম্পাইল-টাইম পলিমরফিজমের উদাহরণ।

15. What is the default access specifier for members of a class in C++?

১৫. C++ এ একটি ক্লাসের সদস্যদের জন্য ডিফল্ট অ্যাক্সেস স্পেসিফায়ার কী?

  • A) public
  • B) private
  • C) protected
  • D) No default

Correct Answer: B) private

Explanation: In C++, if you do not specify an access specifier for members of a class, they are `private` by default. For a `struct`, they are `public` by default.

ব্যাখ্যা: C++ এ, যদি আপনি একটি ক্লাসের সদস্যদের জন্য কোনো অ্যাক্সেস স্পেসিফায়ার উল্লেখ না করেন, তবে তারা ডিফল্টভাবে `private` হয়। একটি `struct` এর জন্য, তারা ডিফল্টভাবে `public` হয়।

16. Which of the following is a primitive data structure?

১৬. নিচের কোনটি একটি প্রিমিটিভ ডেটা স্ট্রাকচার?

  • A) Array
  • B) Stack
  • C) Integer
  • D) Linked List

Correct Answer: C) Integer

Explanation: Primitive data structures are the most basic structures and are directly operated upon by machine instructions. Examples include integer, float, character, and boolean. Arrays, stacks, and linked lists are non-primitive (or composite) data structures.

ব্যাখ্যা: প্রিমিটিভ ডেটা স্ট্রাকচার হলো সবচেয়ে মৌলিক স্ট্রাকচার এবং মেশিন ইন্সট্রাকশন দ্বারা সরাসরি চালিত হয়। এর উদাহরণ হলো ইন্টিজার, ফ্লোট, ক্যারেক্টার এবং বুলিয়ান। অ্যারে, স্ট্যাক এবং লিঙ্কড লিস্ট হলো নন-প্রিমিটিভ (বা কম্পোজিট) ডেটা স্ট্রাকচার।

17. A compiler translates source code into…?

১৭. একটি কম্পাইলার সোর্স কোডকে কিসে অনুবাদ করে?

  • A) Assembly code
  • B) Machine code
  • C) Bytecode
  • D) All of the above are possible

Correct Answer: D) All of the above are possible

Explanation: A compiler’s job is to translate high-level source code. Depending on the language and compiler, the target can be machine code (like for C/C++), assembly code (which is then assembled into machine code), or an intermediate representation like bytecode (like for Java).

ব্যাখ্যা: একটি কম্পাইলারের কাজ হলো উচ্চ-স্তরের সোর্স কোড অনুবাদ করা। ল্যাঙ্গুয়েজ এবং কম্পাইলারের উপর নির্ভর করে, এর টার্গেট হতে পারে মেশিন কোড (যেমন C/C++ এর জন্য), অ্যাসেম্বলি কোড (যা পরে মেশিন কোডে রূপান্তরিত হয়), অথবা বাইটকোডের মতো একটি মধ্যবর্তী কোড (যেমন Java-এর জন্য)।

18. In BASIC, which command is used to take input from the user?

১৮. BASIC-এ, ব্যবহারকারীর কাছ থেকে ইনপুট নিতে কোন কমান্ড ব্যবহার করা হয়?

  • A) GET
  • B) READ
  • C) INPUT
  • D) TAKE

Correct Answer: C) INPUT

Explanation: The `INPUT` statement in the BASIC language is used to prompt the user for data and store the entered value into a variable.

ব্যাখ্যা: BASIC ভাষায় `INPUT` স্টেটমেন্টটি ব্যবহারকারীকে ডেটার জন্য অনুরোধ করতে এবং প্রবেশ করানো মান একটি ভেরিয়েবলে সংরক্ষণ করতে ব্যবহৃত হয়।

19. What is the role of a constructor in a C++ class?

১৯. একটি C++ ক্লাসে কনস্ট্রাক্টরের ভূমিকা কী?

  • A) To destroy the object
  • B) To initialize the data members of an object
  • C) To copy an object
  • D) To perform a calculation

Correct Answer: B) To initialize the data members of an object

Explanation: A constructor is a special member function of a class that is automatically called when an object of that class is created. Its primary purpose is to initialize the object’s data members.

ব্যাখ্যা: কনস্ট্রাক্টর হলো একটি ক্লাসের বিশেষ সদস্য ফাংশন যা সেই ক্লাসের একটি অবজেক্ট তৈরি করার সময় স্বয়ংক্রিয়ভাবে কল হয়। এর প্রধান উদ্দেশ্য হলো অবজেক্টের ডেটা সদস্যদের ইনিশিয়ালাইজ (initialize) করা।

20. Which data structure uses FIFO (First-In, First-Out) principle?

২০. কোন ডেটা স্ট্রাকচার FIFO (ফার্স্ট-ইন, ফার্স্ট-আউট) নীতি ব্যবহার করে?

  • A) Stack
  • B) Queue
  • C) Tree
  • D) Graph

Correct Answer: B) Queue

Explanation: A queue is a linear data structure that follows the FIFO principle. The first element added to the queue will be the first one to be removed, similar to a line of people waiting for a service.

ব্যাখ্যা: কিউ (Queue) একটি লিনিয়ার ডেটা স্ট্রাকচার যা FIFO নীতি অনুসরণ করে। কিউতে যে উপাদানটি প্রথমে যোগ করা হয়, সেটিই প্রথমে সরানো হয়, যেমন কোনো সেবার জন্য অপেক্ষারত মানুষের লাইন।

21. In program design, what is pseudocode?

২১. প্রোগ্রাম ডিজাইনে, সিউডোকোড (pseudocode) কী?

  • A) A visual representation of an algorithm
  • B) A formal programming language
  • C) An informal, high-level description of an algorithm’s operating principle
  • D) A machine-readable code

Correct Answer: C) An informal, high-level description of an algorithm’s operating principle

Explanation: Pseudocode is not a real programming language. It’s a plain language description of the steps in an algorithm, intended for human reading rather than machine reading. It helps programmers plan an algorithm before writing it in actual code.

ব্যাখ্যা: সিউডোকোড কোনো আসল প্রোগ্রামিং ভাষা নয়। এটি একটি অ্যালগরিদমের ধাপগুলোর একটি সরল ভাষার বর্ণনা, যা মেশিনের পরিবর্তে মানুষের পড়ার জন্য তৈরি। এটি প্রোগ্রামারদের আসল কোড লেখার আগে একটি অ্যালগরিদম পরিকল্পনা করতে সহায়তা করে।

22. What does the `\0` character represent in a C string?

২২. C স্ট্রিং-এ `\0` অক্ষরটি কী নির্দেশ করে?

  • A) A space character
  • B) The start of the string
  • C) The null terminator, marking the end of the string
  • D) An invalid character

Correct Answer: C) The null terminator, marking the end of the string

Explanation: In C, strings are arrays of characters. The end of the string is marked by a special null character, `\0`, called the null terminator. Functions that work with strings rely on this character to know where the string ends.

ব্যাখ্যা: C-তে স্ট্রিং হলো ক্যারেক্টার অ্যারে। স্ট্রিংয়ের শেষ একটি বিশেষ নাল ক্যারেক্টার `\0` দ্বারা চিহ্নিত করা হয়, যাকে নাল টার্মিনেটর বলা হয়। স্ট্রিং নিয়ে কাজ করা ফাংশনগুলো স্ট্রিংয়ের শেষ কোথায় তা জানতে এই অক্ষরের উপর নির্ভর করে।

23. Which concept hides the complex implementation details and shows only the essential features of the object?

২৩. কোন ধারণাটি জটিল বাস্তবায়নের বিবরণ লুকিয়ে রাখে এবং শুধুমাত্র অবজেক্টের প্রয়োজনীয় বৈশিষ্ট্যগুলো দেখায়?

  • A) Encapsulation
  • B) Inheritance
  • C) Abstraction
  • D) Polymorphism

Correct Answer: C) Abstraction

Explanation: Abstraction is the concept of hiding the internal details and showing only the functionality. For example, when you drive a car, you only need to know how to use the steering wheel and pedals (the interface), not how the engine works internally (the implementation).

ব্যাখ্যা: অ্যাবস্ট্রাকশন হলো অভ্যন্তরীণ বিবরণ লুকিয়ে রেখে শুধুমাত্র কার্যকারিতা প্রদর্শন করার ধারণা। উদাহরণস্বরূপ, আপনি যখন একটি গাড়ি চালান, তখন আপনাকে কেবল স্টিয়ারিং হুইল এবং প্যাডেল (ইন্টারফেস) কীভাবে ব্যবহার করতে হয় তা জানতে হবে, ইঞ্জিন অভ্যন্তরীণভাবে কীভাবে কাজ করে (বাস্তবায়ন) তা নয়।

24. In C++, a destructor is a member function that is automatically called when…

২৪. C++ এ, ডেস্ট্রাক্টর একটি সদস্য ফাংশন যা স্বয়ংক্রিয়ভাবে কখন কল করা হয়?

  • A) an object is created
  • B) an object is copied
  • C) an object goes out of scope or is explicitly deleted
  • D) an object’s member is accessed

Correct Answer: C) an object goes out of scope or is explicitly deleted

Explanation: A destructor is the counterpart to the constructor. It is called automatically when an object is destroyed (e.g., when it goes out of scope or when `delete` is called on a pointer to the object). Its purpose is to release resources acquired by the object.

ব্যাখ্যা: ডেস্ট্রাক্টর হলো কনস্ট্রাক্টরের বিপরীত। এটি স্বয়ংক্রিয়ভাবে কল করা হয় যখন একটি অবজেক্ট ধ্বংস হয় (যেমন, যখন এটি স্কোপের বাইরে চলে যায় বা অবজেক্টের পয়েন্টারে `delete` কল করা হয়)। এর উদ্দেশ্য হলো অবজেক্ট দ্বারা অর্জিত রিসোর্স মুক্ত করা।

25. Which of these is a correct way to declare a pointer to an integer in C?

২৫. C-তে একটি ইন্টিজারের জন্য পয়েন্টার ঘোষণা করার সঠিক উপায় কোনটি?

  • A) int p;
  • B) pointer int p;
  • C) int *p;
  • D) int &p;

Correct Answer: C) int *p;

Explanation: In C and C++, a pointer is declared using the asterisk `*` symbol between the data type and the variable name. `int *p;` declares `p` as a pointer that can hold the address of an integer variable.

ব্যাখ্যা: C এবং C++ এ, ডেটা টাইপ এবং ভেরিয়েবলের নামের মধ্যে অ্যাস্টেরিস্ক `*` চিহ্ন ব্যবহার করে একটি পয়েন্টার ঘোষণা করা হয়। `int *p;` ঘোষণা করে যে `p` একটি পয়েন্টার যা একটি ইন্টিজার ভেরিয়েবলের অ্যাড্রেস ধারণ করতে পারে।

26. An array is a collection of elements of…

২৬. একটি অ্যারে হলো … উপাদানের একটি সংগ্রহ।

  • A) Different data types
  • B) The same data type
  • C) Only integers
  • D) Only characters

Correct Answer: B) The same data type

Explanation: An array is a fundamental data structure that stores a collection of elements of the same data type in contiguous memory locations. This allows for efficient access to elements using an index.

ব্যাখ্যা: অ্যারে একটি মৌলিক ডেটা স্ট্রাকচার যা একই ডেটা টাইপের উপাদানগুলির একটি সংগ্রহকে সংলগ্ন মেমরি অবস্থানে সংরক্ষণ করে। এটি একটি ইন্ডেক্স ব্যবহার করে উপাদানগুলিতে কার্যকর অ্যাক্সেসের অনুমতি দেয়।

27. Which keyword in C++ is used to prevent a method from being overridden in a derived class?

২৭. C++ এ কোন কীওয়ার্ড একটি ডিরাইভড ক্লাসে মেথডকে ওভাররাইড করা থেকে বিরত রাখতে ব্যবহৃত হয়?

  • A) static
  • B) const
  • C) final
  • D) sealed

Correct Answer: C) final

Explanation: In modern C++ (C++11 and later), the `final` specifier is used to indicate that a virtual function cannot be overridden in a derived class, or that a class cannot be inherited from.

ব্যাখ্যা: আধুনিক C++ (C++11 এবং পরবর্তী) এ, `final` স্পেসিফায়ারটি বোঝাতে ব্যবহৃত হয় যে একটি ভার্চুয়াল ফাংশন কোনো ডিরাইভড ক্লাসে ওভাররাইড করা যাবে না, অথবা একটি ক্লাস থেকে ইনহেরিট করা যাবে না।

28. What is the main difference between a `struct` and a `class` in C++?

২৮. C++ এ `struct` এবং `class` এর মধ্যে প্রধান পার্থক্য কী?

  • A) `struct` cannot have member functions
  • B) `class` members are `public` by default, `struct` members are `private`
  • C) `class` members are `private` by default, `struct` members are `public`
  • D) There is no difference

Correct Answer: C) `class` members are `private` by default, `struct` members are `public`

Explanation: The only difference between a `class` and a `struct` in C++ is the default access level. For a `class`, members are `private` by default. For a `struct`, members are `public` by default.

ব্যাখ্যা: C++ এ `class` এবং `struct` এর মধ্যে একমাত্র পার্থক্য হলো ডিফল্ট অ্যাক্সেস লেভেল। একটি `class` এর জন্য, সদস্যরা ডিফল্টভাবে `private` হয়। একটি `struct` এর জন্য, সদস্যরা ডিফল্টভাবে `public` হয়।

29. Which C standard library header is required for dynamic memory allocation functions like `malloc()` and `free()`?

২৯. `malloc()` এবং `free()` এর মতো ডাইনামিক মেমরি অ্যালোকেশন ফাংশনের জন্য কোন C স্ট্যান্ডার্ড লাইব্রেরি হেডার প্রয়োজন?

  • A) <stdio.h>
  • B) <string.h>
  • C) <math.h>
  • D) <stdlib.h>

Correct Answer: D) <stdlib.h>

Explanation: The Standard Library header `` (or `` in C++) contains declarations for general purpose functions, including dynamic memory management (`malloc`, `calloc`, `realloc`, `free`), random number generation, and string conversions.

ব্যাখ্যা: স্ট্যান্ডার্ড লাইব্রেরি হেডার `` (বা C++ এ ``) তে সাধারণ উদ্দেশ্যে ব্যবহৃত ফাংশনের ঘোষণা থাকে, যার মধ্যে ডাইনামিক মেমরি ম্যানেজমেন্ট (`malloc`, `calloc`, `realloc`, `free`), র‍্যান্ডম সংখ্যা তৈরি এবং স্ট্রিং রূপান্তর অন্তর্ভুক্ত।

30. In BASIC, what does the `LET` keyword do?

৩০. BASIC-এ `LET` কীওয়ার্ড কী কাজ করে?

  • A) It defines a subroutine
  • B) It assigns a value to a variable
  • C) It creates a loop
  • D) It ends the program

Correct Answer: B) It assigns a value to a variable

Explanation: The `LET` statement is used to assign a value to a variable. For example, `LET X = 10`. In many modern dialects of BASIC, the `LET` keyword is optional.

ব্যাখ্যা: `LET` স্টেটমেন্টটি একটি ভেরিয়েবলে একটি মান নির্ধারণ করতে ব্যবহৃত হয়। উদাহরণস্বরূপ, `LET X = 10`। BASIC-এর অনেক আধুনিক সংস্করণে `LET` কীওয়ার্ডটি ঐচ্ছিক।

31. What is a “virtual function” in C++?

৩১. C++ এ “ভার্চুয়াল ফাংশন” কী?

  • A) A function that does not exist
  • B) A member function in a base class that you expect to be redefined in derived classes
  • C) A function that cannot be overridden
  • D) A global function that can be accessed by any class

Correct Answer: B) A member function in a base class that you expect to be redefined in derived classes

Explanation: A virtual function is a member function declared in a base class and overridden by a derived class. When you refer to a derived class object using a pointer or a reference to the base class, you can call the virtual function for that object and execute the derived class’s version of the function. This is the mechanism for runtime polymorphism.

ব্যাখ্যা: একটি ভার্চুয়াল ফাংশন হলো একটি বেস ক্লাসে ঘোষিত সদস্য ফাংশন যা একটি ডিরাইভড ক্লাস দ্বারা ওভাররাইড করা হয়। যখন আপনি বেস ক্লাসের একটি পয়েন্টার বা রেফারেন্স ব্যবহার করে একটি ডিরাইভড ক্লাস অবজেক্টকে রেফার করেন, তখন আপনি সেই অবজেক্টের জন্য ভার্চুয়াল ফাংশন কল করতে পারেন এবং ডিরাইভড ক্লাসের ফাংশন সংস্করণটি কার্যকর করতে পারেন। এটি রানটাইম পলিমরফিজমের পদ্ধতি।

32. The process of finding and fixing errors in a program is called?

৩২. একটি প্রোগ্রামে ভুল খুঁজে বের করা এবং ঠিক করার প্রক্রিয়াকে কী বলা হয়?

  • A) Compiling
  • B) Linking
  • C) Debugging
  • D) Executing

Correct Answer: C) Debugging

Explanation: Debugging is the systematic process of finding and reducing the number of bugs, or defects, in a computer program, to make it behave as expected.

ব্যাখ্যা: ডিবাগিং হলো একটি কম্পিউটার প্রোগ্রামে বাগ বা ত্রুটির সংখ্যা খুঁজে বের করা এবং কমানোর একটি পদ্ধতিগত প্রক্রিয়া, যাতে এটি প্রত্যাশিত আচরণ করে।

33. Which of the following is an interpreted language?

৩৩. নিচের কোনটি একটি ইন্টারপ্রেটেড ল্যাঙ্গুয়েজ?

  • A) C
  • B) C++
  • C) BASIC
  • D) Assembly

Correct Answer: C) BASIC

Explanation: Traditional BASIC is an interpreted language, where an interpreter executes the program line by line. C, C++, and Assembly are typically compiled languages, where the entire source code is translated to machine code before execution.

ব্যাখ্যা: প্রচলিত BASIC একটি ইন্টারপ্রেটেড ল্যাঙ্গুয়েজ, যেখানে একটি ইন্টারপ্রেটার প্রোগ্রামটি লাইন বাই লাইন এক্সিকিউট করে। C, C++ এবং অ্যাসেম্বলি সাধারণত কম্পাইলড ল্যাঙ্গুয়েজ, যেখানে সম্পূর্ণ সোর্স কোড এক্সিকিউশনের আগে মেশিন কোডে অনুবাদ করা হয়।

34. A `union` in C allows you to…

৩৪. C-তে একটি `union` আপনাকে কী করতে দেয়?

  • A) Store multiple data types simultaneously in the same memory location.
  • B) Store different data types at different times in the same memory location.
  • C) Group related functions together.
  • D) Create a constant variable.

Correct Answer: B) Store different data types at different times in the same memory location.

Explanation: A `union` is a special data type that allows storing different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. The size of the union is the size of its largest member.

ব্যাখ্যা: একটি `union` একটি বিশেষ ডেটা টাইপ যা একই মেমরি অবস্থানে বিভিন্ন ডেটা টাইপ সংরক্ষণ করার অনুমতি দেয়। আপনি অনেক সদস্য সহ একটি ইউনিয়ন সংজ্ঞায়িত করতে পারেন, কিন্তু যেকোনো নির্দিষ্ট সময়ে শুধুমাত্র একজন সদস্যের একটি মান থাকতে পারে। ইউনিয়নের আকার তার বৃহত্তম সদস্যের আকারের সমান।

35. What is “operator overloading” in C++?

৩৫. C++ এ “অপারেটর ওভারলোডিং” কী?

  • A) Giving a new meaning to an existing operator for user-defined types.
  • B) Creating a new operator.
  • C) Deleting an existing operator.
  • D) Using an operator with too many operands.

Correct Answer: A) Giving a new meaning to an existing operator for user-defined types.

Explanation: Operator overloading is a form of polymorphism where an operator like `+`, `-`, or `*` is given a special meaning for a user-defined data type (a class). For example, you could overload the `+` operator to add two complex number objects.

ব্যাখ্যা: অপারেটর ওভারলোডিং হলো পলিমরফিজমের একটি রূপ যেখানে `+`, `-`, বা `*` এর মতো একটি অপারেটরকে একটি ব্যবহারকারী-সংজ্ঞায়িত ডেটা টাইপের (একটি ক্লাস) জন্য একটি বিশেষ অর্থ দেওয়া হয়। উদাহরণস্বরূপ, আপনি দুটি জটিল সংখ্যা অবজেক্ট যোগ করার জন্য `+` অপারেটরকে ওভারলোড করতে পারেন।

36. What is the output of `printf(“%d”, 10/3);` in C?

৩৬. C-তে `printf(“%d”, 10/3);` এর আউটপুট কী হবে?

  • A) 3.333333
  • B) 3.0
  • C) 3
  • D) Compilation Error

Correct Answer: C) 3

Explanation: In C, when two integers are divided, the result is an integer division. The fractional part is truncated (discarded). So, `10 / 3` evaluates to 3.

ব্যাখ্যা: C-তে, যখন দুটি পূর্ণসংখ্যা (integer) ভাগ করা হয়, তখন ফলাফলটিও একটি পূর্ণসংখ্যা হয়। ভগ্নাংশ অংশটি বাদ দেওয়া হয়। তাই, `10 / 3` এর ফল 3 হবে।

37. In OOP, the “is-a” relationship is represented by?

৩৭. OOP-তে, “is-a” সম্পর্কটি কীসের দ্বারা উপস্থাপিত হয়?

  • A) Encapsulation
  • B) Polymorphism
  • C) Inheritance
  • D) Composition

Correct Answer: C) Inheritance

Explanation: The “is-a” relationship signifies that one object is a specialized type of another. This is modeled using inheritance. For example, a `Car` is-a `Vehicle`.

ব্যাখ্যা: “is-a” সম্পর্কটি বোঝায় যে একটি অবজেক্ট অন্য একটির বিশেষায়িত রূপ। এটি ইনহেরিটেন্স ব্যবহার করে মডেল করা হয়। উদাহরণস্বরূপ, একটি `Car` হলো একটি `Vehicle`।

38. Which header file is needed to use `cout` and `cin` in C++?

৩৮. C++ এ `cout` এবং `cin` ব্যবহার করার জন্য কোন হেডার ফাইলের প্রয়োজন?

  • A) <stdio.h>
  • B) <conio.h>
  • C) <iostream>
  • D) <string>

Correct Answer: C) <iostream>

Explanation: The `` header file contains the definitions for the standard input/output stream objects, such as `cin` (standard input), `cout` (standard output), and `cerr` (standard error).

ব্যাখ্যা: `` হেডার ফাইলে স্ট্যান্ডার্ড ইনপুট/আউটপুট স্ট্রিম অবজেক্টের সংজ্ঞা রয়েছে, যেমন `cin` (স্ট্যান্ডার্ড ইনপুট), `cout` (স্ট্যান্ডার্ড আউটপুট), এবং `cerr` (স্ট্যান্ডার্ড এরর)।

39. A node in a singly linked list contains a data field and a…?

৩৯. একটি সিঙ্গল লিঙ্কড লিস্টের নোডে একটি ডেটা ফিল্ড এবং একটি … থাকে।

  • A) Pointer to the previous node
  • B) Pointer to the next node
  • C) Pointer to the head node
  • D) An integer value

Correct Answer: B) Pointer to the next node

Explanation: Each node in a singly linked list consists of two parts: the data itself and a pointer (or link) to the next node in the sequence. The last node’s pointer is typically `NULL`.

ব্যাখ্যা: একটি সিঙ্গল লিঙ্কড লিস্টের প্রতিটি নোড দুটি অংশ নিয়ে গঠিত: ডেটা এবং ক্রমের পরবর্তী নোডের একটি পয়েন্টার (বা লিঙ্ক)। শেষ নোডের পয়েন্টারটি সাধারণত `NULL` হয়।

40. In object-oriented programming, an object is an instance of a…?

৪০. অবজেক্ট-ওরিয়েন্টেড প্রোগ্রামিং-এ, একটি অবজেক্ট হলো একটি … এর ইনস্ট্যান্স।

  • A) Method
  • B) Class
  • C) Variable
  • D) Program

Correct Answer: B) Class

Explanation: A class is a blueprint for creating objects. An object is a concrete instance of a class, with actual values for the attributes defined in the class.

ব্যাখ্যা: একটি ক্লাস হলো অবজেক্ট তৈরির একটি ব্লুপ্রিন্ট। একটি অবজেক্ট হলো ক্লাসের একটি বাস্তব উদাহরণ, যেখানে ক্লাসে সংজ্ঞায়িত বৈশিষ্ট্যগুলির জন্য আসল মান থাকে।

41. In C++, what is the `this` pointer?

৪১. C++ এ `this` পয়েন্টার কী?

  • A) A pointer to the base class
  • B) A pointer to the current object invoking the member function
  • C) A null pointer
  • D) A pointer to a static member

Correct Answer: B) A pointer to the current object invoking the member function

Explanation: The `this` pointer is an implicit pointer that is available to all non-static member functions of a class. It points to the specific object on which the member function was called.

ব্যাখ্যা: `this` পয়েন্টার হলো একটি অপ্রকাশিত (implicit) পয়েন্টার যা একটি ক্লাসের সমস্ত নন-স্ট্যাটিক সদস্য ফাংশনের জন্য উপলব্ধ। এটি সেই নির্দিষ্ট অবজেক্টের দিকে নির্দেশ করে যার উপর সদস্য ফাংশনটি কল করা হয়েছিল।

42. What is an algorithm?

৪২. অ্যালগরিদম কী?

  • A) A computer program
  • B) A flowchart
  • C) A step-by-step procedure for solving a problem
  • D) A programming language syntax

Correct Answer: C) A step-by-step procedure for solving a problem

Explanation: An algorithm is a well-defined, finite set of instructions or rules designed to perform a specific task or solve a particular problem. It is the logical foundation of a program.

ব্যাখ্যা: অ্যালগরিদম হলো একটি নির্দিষ্ট কাজ সম্পাদন বা কোনো বিশেষ সমস্যা সমাধানের জন্য ডিজাইন করা সুস্পষ্ট, সসীম নির্দেশাবলী বা নিয়মের একটি সেট। এটি একটি প্রোগ্রামের যৌক্তিক ভিত্তি।

43. Which of the following is not a type of inheritance?

৪৩. নিচের কোনটি ইনহেরিটেন্সের একটি প্রকার নয়?

  • A) Multiple
  • B) Multilevel
  • C) Distributed
  • D) Hierarchical

Correct Answer: C) Distributed

Explanation: Multiple, Multilevel, Single, and Hierarchical are all valid types of inheritance in object-oriented programming. “Distributed” is not a standard type of inheritance; it relates to distributed computing.

ব্যাখ্যা: মাল্টিপল, মাল্টিলেভেল, সিঙ্গেল এবং হায়ারারকিক্যাল হলো অবজেক্ট-ওরিয়েন্টেড প্রোগ্রামিং-এ ইনহেরিটেন্সের বৈধ প্রকার। “ডিস্ট্রিবিউটেড” ইনহেরিটেন্সের কোনো স্ট্যান্ডার্ড প্রকার নয়; এটি ডিস্ট্রিবিউটেড কম্পিউটিং এর সাথে সম্পর্কিত।

44. The `const` keyword in C is used to…

৪৪. C-তে `const` কীওয়ার্ডটি কীসের জন্য ব্যবহৃত হয়?

  • A) Make a variable’s value unmodifiable
  • B) Declare a static variable
  • C) Declare a global variable
  • D) Make a variable volatile

Correct Answer: A) Make a variable’s value unmodifiable

Explanation: The `const` qualifier is used to declare a variable whose value cannot be changed after initialization. It enforces read-only access to the variable.

ব্যাখ্যা: `const` কোয়ালিফায়ারটি একটি ভেরিয়েবল ঘোষণা করতে ব্যবহৃত হয় যার মান ইনিশিয়ালাইজেশনের পরে পরিবর্তন করা যায় না। এটি ভেরিয়েবলে শুধুমাত্র পঠনযোগ্য (read-only) অ্যাক্সেস নিশ্চিত করে।

45. In BASIC, the `GOTO` statement creates a(n)…

৪৫. BASIC-এ `GOTO` স্টেটমেন্ট একটি … তৈরি করে।

  • A) Conditional branch
  • B) Unconditional branch
  • C) Function call
  • D) Variable assignment

Correct Answer: B) Unconditional branch

Explanation: The `GOTO` statement provides an unconditional jump from one line of code to another specified by a line number. Its overuse can lead to “spaghetti code,” which is hard to read and maintain.

ব্যাখ্যা: `GOTO` স্টেটমেন্ট একটি লাইন নম্বর দ্বারা নির্দিষ্ট করা কোডের এক লাইন থেকে অন্য লাইনে একটি শর্তহীন লাফ (unconditional jump) প্রদান করে। এর অতিরিক্ত ব্যবহার “স্প্যাগেটি কোড” তৈরি করতে পারে, যা পড়া এবং রক্ষণাবেক্ষণ করা কঠিন।

46. What is an Abstract Class?

৪৬. একটি অ্যাবস্ট্রাক্ট ক্লাস কী?

  • A) A class that cannot have objects
  • B) A class that has at least one pure virtual function
  • C) A class used only for inheritance
  • D) All of the above

Correct Answer: D) All of the above

Explanation: An abstract class in C++ is a class that has at least one pure virtual function (a function with no definition, e.g., `virtual void func() = 0;`). Because it’s incomplete, you cannot create objects of an abstract class. It is designed to be a base class from which other classes are derived.

ব্যাখ্যা: C++ এ একটি অ্যাবস্ট্রাক্ট ক্লাস হলো এমন একটি ক্লাস যার অন্তত একটি পিওর ভার্চুয়াল ফাংশন রয়েছে (একটি ফাংশন যার কোনো সংজ্ঞা নেই, যেমন `virtual void func() = 0;`)। এটি অসম্পূর্ণ হওয়ায় আপনি একটি অ্যাবস্ট্রাক্ট ক্লাসের অবজেক্ট তৈরি করতে পারবেন না। এটি একটি বেস ক্লাস হিসেবে ডিজাইন করা হয়, যেখান থেকে অন্যান্য ক্লাস ডিরাইভ করা হয়।

47. What does the preprocessor directive `#include` do in C/C++?

৪৭. C/C++ এ `#include` প্রিপ্রসেসর ডিরেক্টিভটি কী কাজ করে?

  • A) It links the library files during compilation.
  • B) It includes the content of another file into the source file.
  • C) It compiles the included file separately.
  • D) It defines a macro.

Correct Answer: B) It includes the content of another file into the source file.

Explanation: The `#include` directive tells the preprocessor to treat the contents of a specified file as if they appear in the source program at the point where the directive appears. It is typically used for header files.

ব্যাখ্যা: `#include` ডিরেক্টিভটি প্রিপ্রসেসরকে বলে যে একটি নির্দিষ্ট ফাইলের বিষয়বস্তু সোর্স প্রোগ্রামের সেই স্থানে বসাতে হবে যেখানে ডিরেক্টিভটি রয়েছে। এটি সাধারণত হেডার ফাইলের জন্য ব্যবহৃত হয়।

48. The `break` statement is used to exit from a…?

৪৮. `break` স্টেটমেন্টটি কী থেকে বের হতে ব্যবহৃত হয়?

  • A) `for` loop
  • B) `while` loop
  • C) `switch` statement
  • D) All of the above

Correct Answer: D) All of the above

Explanation: The `break` statement in C/C++ terminates the execution of the nearest enclosing loop (`for`, `while`, `do-while`) or `switch` statement. Control passes to the statement that follows the terminated statement.

ব্যাখ্যা: C/C++ এ `break` স্টেটমেন্টটি নিকটতম লুপ (`for`, `while`, `do-while`) বা `switch` স্টেটমেন্টের এক্সিকিউশন বন্ধ করে দেয়। নিয়ন্ত্রণ সমাপ্ত স্টেটমেন্টের পরবর্তী স্টেটমেন্টে চলে যায়।

49. What is the time complexity of accessing an element in an array by its index?

৪৯. ইন্ডেক্স দ্বারা একটি অ্যারের উপাদানে অ্যাক্সেস করার টাইম কমপ্লেক্সিটি কত?

  • A) O(1)
  • B) O(n)
  • C) O(log n)
  • D) O(n^2)

Correct Answer: A) O(1)

Explanation: Accessing an element in an array is a constant time operation, O(1), because the memory location of the element can be calculated directly using its index and the base address of the array, regardless of the array’s size.

ব্যাখ্যা: একটি অ্যারেতে একটি উপাদান অ্যাক্সেস করা একটি ধ্রুবক সময়ের অপারেশন, O(1), কারণ অ্যারের আকার নির্বিশেষে, উপাদানের মেমরি অবস্থান সরাসরি তার ইন্ডেক্স এবং অ্যারের বেস অ্যাড্রেস ব্যবহার করে গণনা করা যায়।

50. Which symbol is used for a single-line comment in C++?

৫০. C++ এ এক-লাইনের কমেন্টের জন্য কোন প্রতীক ব্যবহৃত হয়?

  • A) //
  • B) /* … */
  • C) #
  • D) —

Correct Answer: A) //

Explanation: In C++, `//` is used to start a single-line comment. The compiler ignores everything from `//` to the end of the line. `/* … */` is used for multi-line comments.

ব্যাখ্যা: C++ এ, `//` একটি এক-লাইনের কমেন্ট শুরু করতে ব্যবহৃত হয়। কম্পাইলার `//` থেকে লাইনের শেষ পর্যন্ত সবকিছু উপেক্ষা করে। `/* … */` বহু-লাইনের কমেন্টের জন্য ব্যবহৃত হয়।

51. The scope resolution operator in C++ is?

৫১. C++ এ স্কোপ রেজোলিউশন অপারেটর কোনটি?

  • A) .
  • B) ->
  • C) ::
  • D) :

Correct Answer: C) ::

Explanation: The `::` (Scope Resolution) operator is used to define a function outside a class, access a class’s static members, or to access a global variable when there is a local variable with the same name.

ব্যাখ্যা: `::` (স্কোপ রেজোলিউশন) অপারেটরটি একটি ক্লাসের বাইরে একটি ফাংশন সংজ্ঞায়িত করতে, একটি ক্লাসের স্ট্যাটিক সদস্যদের অ্যাক্সেস করতে, বা একই নামের একটি লোকাল ভেরিয়েবল থাকলে গ্লোবাল ভেরিয়েবল অ্যাক্সেস করতে ব্যবহৃত হয়।

52. Which of the following is not a valid loop structure in C?

৫২. নিচের কোনটি C-তে একটি বৈধ লুপ স্ট্রাকচার নয়?

  • A) for
  • B) while
  • C) repeat…until
  • D) do…while

Correct Answer: C) repeat…until

Explanation: C provides `for`, `while`, and `do-while` loops. The `repeat…until` loop structure is found in other languages like Pascal, but not in C.

ব্যাখ্যা: C-তে `for`, `while`, এবং `do-while` লুপ রয়েছে। `repeat…until` লুপ স্ট্রাকচারটি প্যাসকেলের মতো অন্যান্য ভাষায় পাওয়া যায়, কিন্তু C-তে নয়।

53. What is the difference between `i++` and `++i` in C?

৫৩. C-তে `i++` এবং `++i` এর মধ্যে পার্থক্য কী?

  • A) `i++` is post-increment, `++i` is pre-increment
  • B) `++i` is post-increment, `i++` is pre-increment
  • C) Both are pre-increment
  • D) There is no difference

Correct Answer: A) `i++` is post-increment, `++i` is pre-increment

Explanation: `++i` (pre-increment) increments the value of `i` and then returns the incremented value. `i++` (post-increment) returns the original value of `i` first, and then increments it.

ব্যাখ্যা: `++i` (প্রি-ইনক্রিমেন্ট) `i`-এর মান বৃদ্ধি করে এবং তারপর বর্ধিত মানটি রিটার্ন করে। `i++` (পোস্ট-ইনক্রিমেন্ট) প্রথমে `i`-এর আসল মান রিটার্ন করে এবং তারপর এটিকে বৃদ্ধি করে।

54. A function prototype in C is used to…

৫৪. C-তে একটি ফাংশন প্রোটোটাইপ কীসের জন্য ব্যবহৃত হয়?

  • A) Define the function’s logic
  • B) Call the function
  • C) Declare the function’s signature to the compiler
  • D) Allocate memory for the function

Correct Answer: C) Declare the function’s signature to the compiler

Explanation: A function prototype is a declaration that tells the compiler about a function’s name, return type, and parameters. This allows the compiler to perform type checking when the function is called before it is defined.

ব্যাখ্যা: একটি ফাংশন প্রোটোটাইপ হলো একটি ঘোষণা যা কম্পাইলারকে একটি ফাংশনের নাম, রিটার্ন টাইপ এবং প্যারামিটার সম্পর্কে জানায়। এটি কম্পাইলারকে ফাংশনটি সংজ্ঞায়িত করার আগে কল করার সময় টাইপ চেকিং করতে দেয়।

55. In early BASIC, what was the primary purpose of line numbers?

৫৫. প্রাথমিক BASIC-এ, লাইন নম্বরের প্রধান উদ্দেশ্য কী ছিল?

  • A) To count the lines of code
  • B) For debugging purposes only
  • C) To specify the sequence of execution and as targets for statements like GOTO
  • D) To declare variables

Correct Answer: C) To specify the sequence of execution and as targets for statements like GOTO

Explanation: In traditional BASIC, every line had to start with a number. These numbers determined the order of execution and were used as labels for control flow statements like `GOTO` and `GOSUB`.

ব্যাখ্যা: প্রচলিত BASIC-এ, প্রতিটি লাইন একটি সংখ্যা দিয়ে শুরু হতে হতো। এই সংখ্যাগুলি এক্সিকিউশনের ক্রম নির্ধারণ করত এবং `GOTO` ও `GOSUB`-এর মতো কন্ট্রোল ফ্লো স্টেটমেন্টের জন্য লেবেল হিসাবে ব্যবহৃত হতো।

56. Which of the following is an example of a “has-a” relationship in OOP?

৫৬. নিচের কোনটি OOP-তে “has-a” সম্পর্কের একটি উদাহরণ?

  • A) A `Dog` is an `Animal`.
  • B) A `Car` has an `Engine`.
  • C) An `Apple` is a `Fruit`.
  • D) A `Manager` is an `Employee`.

Correct Answer: B) A `Car` has an `Engine`.

Explanation: The “has-a” relationship is modeled using composition or aggregation, where one class contains an object of another class as a member. A `Car` containing an `Engine` object is a classic example. The “is-a” relationship (A, C, D) is modeled by inheritance.

ব্যাখ্যা: “has-a” সম্পর্কটি কম্পোজিশন বা অ্যাগ্রিগেশন ব্যবহার করে মডেল করা হয়, যেখানে একটি ক্লাস অন্য একটি ক্লাসের অবজেক্টকে সদস্য হিসাবে ধারণ করে। একটি `Car`-এর মধ্যে একটি `Engine` অবজেক্ট থাকা একটি ক্লাসিক উদাহরণ। “is-a” সম্পর্ক (A, C, D) ইনহেরিটেন্স দ্বারা মডেল করা হয়।

57. `malloc()` in C returns a pointer of type…

৫৭. C-তে `malloc()` কোন টাইপের একটি পয়েন্টার রিটার্ন করে?

  • A) `int *`
  • B) `char *`
  • C) `void *`
  • D) `NULL`

Correct Answer: C) `void *`

Explanation: The `malloc()` function allocates a block of memory of a specified size and returns a pointer to the beginning of the block. This pointer is of type `void*` (generic pointer), which can be cast to any pointer type.

ব্যাখ্যা: `malloc()` ফাংশনটি একটি নির্দিষ্ট আকারের মেমরি ব্লক বরাদ্দ করে এবং ব্লকের শুরুতে একটি পয়েন্টার রিটার্ন করে। এই পয়েন্টারটি `void*` (জেনেরিক পয়েন্টার) টাইপের, যা যেকোনো পয়েন্টার টাইপে কাস্ট করা যেতে পারে।

58. The process of converting a high-level language program into machine language is done by a(n)…

৫৮. একটি উচ্চ-স্তরের ভাষার প্রোগ্রামকে মেশিন ভাষায় রূপান্তর করার প্রক্রিয়াটি কে করে?

  • A) Assembler
  • B) Linker
  • C) Compiler
  • D) Loader

Correct Answer: C) Compiler

Explanation: A compiler is a special program that takes source code written in a high-level language (like C, C++) and translates it into a lower-level language, typically machine code, that the computer’s CPU can execute directly.

ব্যাখ্যা: একটি কম্পাইলার হলো একটি বিশেষ প্রোগ্রাম যা উচ্চ-স্তরের ভাষায় (যেমন C, C++) লেখা সোর্স কোড নেয় এবং এটিকে একটি নিম্ন-স্তরের ভাষায়, সাধারণত মেশিন কোডে, অনুবাদ করে যা কম্পিউটারের CPU সরাসরি এক্সিকিউট করতে পারে।

59. What is a copy constructor in C++?

৫৯. C++ এ একটি কপি কনস্ট্রাক্টর কী?

  • A) A constructor that takes no arguments.
  • B) A constructor that creates a new object as a copy of an existing object.
  • C) A constructor that is used to copy files.
  • D) A constructor that is part of the `string` class only.

Correct Answer: B) A constructor that creates a new object as a copy of an existing object.

Explanation: A copy constructor is a member function which initializes an object using another object of the same class. It is called when a new object is created from an existing object, as a copy.

ব্যাখ্যা: একটি কপি কনস্ট্রাক্টর একটি সদস্য ফাংশন যা একই ক্লাসের অন্য একটি অবজেক্ট ব্যবহার করে একটি অবজেক্টকে ইনিশিয়ালাইজ করে। এটি তখন কল করা হয় যখন একটি বিদ্যমান অবজেক্ট থেকে একটি নতুন অবজেক্ট কপি হিসেবে তৈরি করা হয়।

60. In program design, what does “Top-Down Design” refer to?

৬০. প্রোগ্রাম ডিজাইনে, “টপ-ডাউন ডিজাইন” বলতে কী বোঝায়?

  • A) Starting with the details and building up to the whole system.
  • B) Breaking down a large problem into smaller, more manageable sub-problems.
  • C) Writing code from the last function to the first.
  • D) Designing the user interface first.

Correct Answer: B) Breaking down a large problem into smaller, more manageable sub-problems.

Explanation: Top-Down Design, also known as stepwise refinement, is a problem-solving strategy where you start with the main problem and break it down into smaller, more manageable parts. You then solve each of these smaller parts, which collectively solve the larger problem.

ব্যাখ্যা: টপ-ডাউন ডিজাইন, যা স্টেপওয়াইজ রিফাইনমেন্ট নামেও পরিচিত, একটি সমস্যা সমাধানের কৌশল যেখানে আপনি প্রধান সমস্যা দিয়ে শুরু করেন এবং এটিকে ছোট, আরও পরিচালনাযোগ্য অংশে ভাগ করেন। তারপরে আপনি এই ছোট অংশগুলির প্রত্যেকটির সমাধান করেন, যা সম্মিলিতভাবে বড় সমস্যাটির সমাধান করে।

61. What is the purpose of the `static` keyword on a local variable in C?

৬১. C-তে একটি লোকাল ভেরিয়েবলে `static` কীওয়ার্ডের উদ্দেশ্য কী?

  • A) To make it global.
  • B) To limit its scope to the file.
  • C) To preserve its value between function calls.
  • D) To allocate it on the heap.

Correct Answer: C) To preserve its value between function calls.

Explanation: A `static` local variable retains its value between function invocations. It is initialized only once, when the program starts, and its lifetime extends for the entire duration of the program run, but its scope is still limited to the function where it is declared.

ব্যাখ্যা: একটি `static` লোকাল ভেরিয়েবল ফাংশন কলের মধ্যে তার মান ধরে রাখে। এটি প্রোগ্রাম শুরু হওয়ার সময় শুধুমাত্র একবার ইনিশিয়ালাইজ করা হয় এবং এর জীবনকাল সম্পূর্ণ প্রোগ্রাম চলাকালীন স্থায়ী হয়, কিন্তু এর স্কোপ শুধুমাত্র সেই ফাংশনের মধ্যে সীমাবদ্ধ থাকে যেখানে এটি ঘোষিত হয়েছে।

62. Which data structure is typically used to implement a recursive function call mechanism?

৬২. রিকার্সিভ ফাংশন কল মেকানিজম বাস্তবায়ন করতে সাধারণত কোন ডেটা স্ট্রাকচার ব্যবহার করা হয়?

  • A) Queue
  • B) Stack
  • C) Array
  • D) Linked List

Correct Answer: B) Stack

Explanation: The call stack is a stack data structure that stores information about the active subroutines (functions) of a computer program. Each time a function is called, a new frame is pushed onto the stack containing its local variables and return address. This LIFO (Last-In, First-Out) behavior is perfect for managing nested and recursive function calls.

ব্যাখ্যা: কল স্ট্যাক একটি স্ট্যাক ডেটা স্ট্রাকচার যা একটি কম্পিউটার প্রোগ্রামের সক্রিয় সাবরুটিন (ফাংশন) সম্পর্কে তথ্য সংরক্ষণ করে। প্রতিবার যখন একটি ফাংশন কল করা হয়, তখন এর লোকাল ভেরিয়েবল এবং রিটার্ন অ্যাড্রেসসহ একটি নতুন ফ্রেম স্ট্যাকে পুশ করা হয়। এই LIFO (লাস্ট-ইন, ফার্স্ট-আউট) আচরণটি নেস্টেড এবং রিকার্সিভ ফাংশন কল পরিচালনার জন্য উপযুক্ত।

63. What is the result of `10 % 3` in C/C++?

৬৩. C/C++ এ `10 % 3`-এর ফল কী?

  • A) 3
  • B) 1
  • C) 0
  • D) 3.33

Correct Answer: B) 1

Explanation: The `%` operator is the modulus (or remainder) operator. It computes the remainder of the division of the first operand by the second. `10` divided by `3` is `3` with a remainder of `1`.

ব্যাখ্যা: `%` অপারেটরটি হলো মডুলাস (বা ভাগশেষ) অপারেটর। এটি প্রথম অপারেন্ডকে দ্বিতীয়টি দ্বারা ভাগ করার ভাগশেষ গণনা করে। `10` কে `3` দ্বারা ভাগ করলে ফল `3` এবং ভাগশেষ `1` হয়।

64. An “interface” in object-oriented design is…

৬৪. অবজেক্ট-ওরিয়েন্টেড ডিজাইনে একটি “ইন্টারফেস” হলো…

  • A) The physical user interface of the program.
  • B) A description of all the functions that a class must have in order to be a “new-and-improved” version of that interface.
  • C) The private members of a class.
  • D) The internal implementation of a class.

Correct Answer: B) A description of all the functions that a class must have in order to be a “new-and-improved” version of that interface.

Explanation: An interface defines a contract. It specifies a set of method signatures that a class must implement, without providing the implementation itself. In C++, this is often achieved using an abstract class with only pure virtual functions.

ব্যাখ্যা: একটি ইন্টারফেস একটি চুক্তি সংজ্ঞায়িত করে। এটি মেথড সিগনেচারের একটি সেট নির্দিষ্ট করে যা একটি ক্লাসকে অবশ্যই বাস্তবায়ন করতে হবে, কিন্তু নিজে কোনো বাস্তবায়ন প্রদান করে না। C++ এ, এটি প্রায়শই শুধুমাত্র পিওর ভার্চুয়াল ফাংশনসহ একটি অ্যাবস্ট্রাক্ট ক্লাস ব্যবহার করে অর্জন করা হয়।

65. Which of these keywords is used to manually deallocate memory in C++ that was allocated with `new`?

৬৫. `new` দিয়ে বরাদ্দ করা মেমরি C++ এ ম্যানুয়ালি ডি-অ্যালোকেট করতে কোন কীওয়ার্ড ব্যবহার করা হয়?

  • A) `free`
  • B) `remove`
  • C) `delete`
  • D) `clear`

Correct Answer: C) `delete`

Explanation: In C++, memory allocated with the `new` operator must be deallocated with the `delete` operator to prevent memory leaks. For arrays allocated with `new[]`, you must use `delete[]`.

ব্যাখ্যা: C++ এ, `new` অপারেটর দিয়ে বরাদ্দ করা মেমরি মেমরি লিক প্রতিরোধ করতে `delete` অপারেটর দিয়ে ডি-অ্যালোকেট করতে হবে। `new[]` দিয়ে বরাদ্দ করা অ্যারের জন্য, আপনাকে অবশ্যই `delete[]` ব্যবহার করতে হবে।

66. A rhombus symbol in a flowchart represents…

৬৬. একটি ফ্লোচার্টে রম্বস প্রতীক কী নির্দেশ করে?

  • A) Input/Output
  • B) Process
  • C) Decision
  • D) Terminator (Start/End)

Correct Answer: C) Decision

Explanation: In standard flowcharts, the rhombus (or diamond) shape is used to represent a decision point, such as an `if-else` condition. It typically has one entry point and two or more exit points (e.g., True/False).

ব্যাখ্যা: স্ট্যান্ডার্ড ফ্লোচার্টে, রম্বস (বা ডায়মন্ড) আকৃতিটি একটি সিদ্ধান্ত বিন্দু, যেমন একটি `if-else` শর্ত, উপস্থাপন করতে ব্যবহৃত হয়। এর সাধারণত একটি প্রবেশ বিন্দু এবং দুই বা ততোধিক প্রস্থান বিন্দু (যেমন, True/False) থাকে।

67. The `typedef` keyword in C is used to…

৬৭. C-তে `typedef` কীওয়ার্ডটি কীসের জন্য ব্যবহৃত হয়?

  • A) Define a new data type.
  • B) Give an existing data type a new name.
  • C) Define a variable type.
  • D) Declare a function.

Correct Answer: B) Give an existing data type a new name.

Explanation: `typedef` allows you to create an alias or a new name for an existing data type. This can be used to make complex type declarations (like for structs or function pointers) easier to read and use.

ব্যাখ্যা: `typedef` আপনাকে একটি বিদ্যমান ডেটা টাইপের জন্য একটি উপনাম বা নতুন নাম তৈরি করতে দেয়। এটি জটিল টাইপ ঘোষণাগুলিকে (যেমন struct বা ফাংশন পয়েন্টারের জন্য) পড়া এবং ব্যবহার করা সহজ করতে ব্যবহার করা যেতে পারে।

68. A class in which all member functions are `static` is most similar to…

৬৮. এমন একটি ক্লাস যার সমস্ত সদস্য ফাংশন `static`, সেটি কিসের সাথে সবচেয়ে বেশি সাদৃশ্যপূর্ণ?

  • A) An abstract class
  • B) A namespace grouping related functions
  • C) An interface
  • D) A derived class

Correct Answer: B) A namespace grouping related functions

Explanation: If all functions in a class are static, you don’t need to create an object of the class to call them. You can call them directly using the class name (e.g., `MyClass::myFunction()`). This behavior is very similar to grouping a set of related functions inside a namespace.

ব্যাখ্যা: যদি একটি ক্লাসের সমস্ত ফাংশন স্ট্যাটিক হয়, তবে সেগুলিকে কল করার জন্য ক্লাসের একটি অবজেক্ট তৈরি করার প্রয়োজন নেই। আপনি ক্লাসের নাম ব্যবহার করে সরাসরি কল করতে পারেন (যেমন, `MyClass::myFunction()`)। এই আচরণটি একটি নেমস্পেসের ভিতরে সম্পর্কিত ফাংশনগুলির একটি সেটকে গোষ্ঠীবদ্ধ করার মতো।

69. Dereferencing a `NULL` pointer in C/C++ typically leads to…

৬৯. C/C++ এ একটি `NULL` পয়েন্টার ডি-রেফারেন্স করলে সাধারণত কী হয়?

  • A) A compile-time error
  • B) A warning
  • C) Undefined behavior (often a runtime crash)
  • D) The program continuing normally

Correct Answer: C) Undefined behavior (often a runtime crash)

Explanation: A `NULL` pointer does not point to any valid memory location. Attempting to access the memory it “points” to (dereferencing) is a serious error that results in undefined behavior. On most modern operating systems, this causes a segmentation fault and the program crashes.

ব্যাখ্যা: একটি `NULL` পয়েন্টার কোনো বৈধ মেমরি অবস্থানের দিকে নির্দেশ করে না। এটি যে মেমরিকে “নির্দেশ” করে তা অ্যাক্সেস করার চেষ্টা করা (ডি-রেফারেন্সিং) একটি গুরুতর ত্রুটি যা অনির্ধারিত আচরণের (undefined behavior) দিকে পরিচালিত করে। বেশিরভাগ আধুনিক অপারেটিং সিস্টেমে, এটি একটি সেগমেন্টেশন ফল্ট ঘটায় এবং প্রোগ্রামটি ক্র্যাশ করে।

70. What is a “friend function” in C++?

৭০. C++ এ “ফ্রেন্ড ফাংশন” কী?

  • A) A function that is a member of another class.
  • B) A non-member function that is granted access to the private and protected members of a class.
  • C) A function that can only be called by friends of the programmer.
  • D) A function that belongs to every class.

Correct Answer: B) A non-member function that is granted access to the private and protected members of a class.

Explanation: A friend function of a class is a function that is not a member of the class but has access to its private and protected members. It is declared inside the class with the `friend` keyword.

ব্যাখ্যা: একটি ক্লাসের ফ্রেন্ড ফাংশন এমন একটি ফাংশন যা ক্লাসের সদস্য নয় কিন্তু তার প্রাইভেট এবং প্রোটেক্টেড সদস্যদের অ্যাক্সেস করার অনুমতি পায়। এটি ক্লাসের ভিতরে `friend` কীওয়ার্ড দিয়ে ঘোষণা করা হয়।

71. Which statement is true about BASIC language?

৭১. BASIC ভাষা সম্পর্কে কোন বক্তব্যটি সত্য?

  • A) It was designed for complex scientific computing.
  • B) It was designed to be easy for beginners to learn.
  • C) It is a systems programming language.
  • D) It is a purely object-oriented language.

Correct Answer: B) It was designed to be easy for beginners to learn.

Explanation: BASIC stands for Beginner’s All-purpose Symbolic Instruction Code. Its primary design goal was to be simple and easy for students and non-computer science majors to learn and use.

ব্যাখ্যা: BASIC-এর পূর্ণরূপ হলো Beginner’s All-purpose Symbolic Instruction Code। এর প্রধান ডিজাইনের লক্ষ্য ছিল ছাত্র এবং নন-কম্পিউটার সায়েন্স মেজরদের জন্য শেখা এবং ব্যবহার করা সহজ হওয়া।

72. Implementation of a primitive data structure is directly supported by…

৭২. একটি প্রিমিটিভ ডেটা স্ট্রাকচারের বাস্তবায়ন সরাসরি কী দ্বারা সমর্থিত?

  • A) The operating system
  • B) The compiler
  • C) Machine-level instructions
  • D) A standard library

Correct Answer: C) Machine-level instructions

Explanation: Primitive data types (like `int`, `float`, `char`) are “primitive” because they are the most basic types available, and there are direct machine-level instructions (like ADD, LOAD, STORE) to operate on them.

ব্যাখ্যা: প্রিমিটিভ ডেটা টাইপ (যেমন `int`, `float`, `char`) “প্রিমিটিভ” কারণ এগুলি সবচেয়ে মৌলিক টাইপ এবং এগুলির উপর কাজ করার জন্য সরাসরি মেশিন-স্তরের নির্দেশাবলী (যেমন ADD, LOAD, STORE) রয়েছে।

73. The `continue` statement in C…

৭৩. C-তে `continue` স্টেটমেন্ট…

  • A) Exits the loop completely.
  • B) Skips the rest of the current iteration and starts the next one.
  • C) Pauses the program execution.
  • D) Continues to the next line of code.

Correct Answer: B) Skips the rest of the current iteration and starts the next one.

Explanation: Unlike `break` which exits the loop, the `continue` statement forces the next iteration of the loop to take place, skipping any code in between.

ব্যাখ্যা: `break`-এর মতো লুপ থেকে বেরিয়ে যাওয়ার পরিবর্তে, `continue` স্টেটমেন্টটি লুপের পরবর্তী ইটারেশন শুরু করতে বাধ্য করে এবং এর মাঝখানের কোনো কোড এড়িয়ে যায়।

74. In C++, which stream is used for standard error output?

৭৪. C++ এ, স্ট্যান্ডার্ড এরর আউটপুটের জন্য কোন স্ট্রিম ব্যবহার করা হয়?

  • A) `cin`
  • B) `cout`
  • C) `cerr` or `clog`
  • D) `cfile`

Correct Answer: C) `cerr` or `clog`

Explanation: `cerr` is the standard error stream, which is unbuffered. `clog` is also for error messages but is buffered. They are used for displaying error messages, which are often directed to a different destination than standard output.

ব্যাখ্যা: `cerr` হলো স্ট্যান্ডার্ড এরর স্ট্রিম, যা আনবাফার্ড। `clog` ও এরর মেসেজের জন্য, কিন্তু এটি বাফার্ড। এগুলি এরর মেসেজ প্রদর্শনের জন্য ব্যবহৃত হয়, যা প্রায়শই স্ট্যান্ডার্ড আউটপুট থেকে ভিন্ন গন্তব্যে পাঠানো হয়।

75. The ability of an object to take on many forms is a key part of which OOP concept?

৭৫. একটি অবজেক্টের বিভিন্ন রূপ ধারণ করার ক্ষমতা কোন OOP ধারণার একটি মূল অংশ?

  • A) Encapsulation
  • B) Inheritance
  • C) Abstraction
  • D) Polymorphism

Correct Answer: D) Polymorphism

Explanation: Polymorphism literally means “many forms”. It is the ability for a message or data to be processed in more than one form. This is achieved through mechanisms like function overloading, operator overloading, and virtual functions.

ব্যাখ্যা: পলিমরফিজম এর আক্ষরিক অর্থ “বহুরূপতা”। এটি একটি মেসেজ বা ডেটাকে একাধিক রূপে প্রক্রিয়া করার ক্ষমতা। এটি ফাংশন ওভারলোডিং, অপারেটর ওভারলোডিং এবং ভার্চুয়াল ফাংশনের মতো পদ্ধতির মাধ্যমে অর্জন করা হয়।

76. A pointer that has been deallocated but is still being used is called a…

৭৬. এমন একটি পয়েন্টার যা ডি-অ্যালোকেট করা হয়েছে কিন্তু এখনও ব্যবহৃত হচ্ছে, তাকে কী বলা হয়?

  • A) Null pointer
  • B) Void pointer
  • C) Dangling pointer
  • D) Wild pointer

Correct Answer: C) Dangling pointer

Explanation: A dangling pointer is a pointer that points to a memory location that has been freed (deallocated). Using a dangling pointer leads to undefined behavior and can be a source of serious bugs.

ব্যাখ্যা: একটি ড্যাংলিং পয়েন্টার হলো এমন একটি পয়েন্টার যা একটি মুক্ত (ডি-অ্যালোকেটেড) মেমরি অবস্থানের দিকে নির্দেশ করে। একটি ড্যাংলিং পয়েন্টার ব্যবহার করলে অনির্ধারিত আচরণ ঘটে এবং এটি গুরুতর বাগের উৎস হতে পারে।

77. In program design, “Bottom-Up Design” is a methodology where…

৭৭. প্রোগ্রাম ডিজাইনে, “বটম-আপ ডিজাইন” এমন একটি পদ্ধতি যেখানে…

  • A) The system is broken down into smaller components.
  • B) Individual components are designed and tested first, then integrated into larger systems.
  • C) The design starts from the user interface.
  • D) The main function is designed first.

Correct Answer: B) Individual components are designed and tested first, then integrated into larger systems.

Explanation: Bottom-Up Design is the opposite of Top-Down Design. It starts with designing, implementing, and testing the lowest-level components (the “primitives”) and then uses them to build up more complex, higher-level systems.

ব্যাখ্যা: বটম-আপ ডিজাইন হলো টপ-ডাউন ডিজাইনের বিপরীত। এটি সর্বনিম্ন স্তরের উপাদানগুলি (“প্রিমিটিভ”) ডিজাইন, বাস্তবায়ন এবং পরীক্ষা করার মাধ্যমে শুরু হয় এবং তারপরে সেগুলিকে আরও জটিল, উচ্চ-স্তরের সিস্টেম তৈরি করতে ব্যবহার করে।

78. What does `->` operator do in C/C++?

৭৮. C/C++ এ `->` অপারেটর কী কাজ করে?

  • A) Accesses a member of an object directly.
  • B) Accesses a member of a class through a pointer to an object of that class.
  • C) It is used for pointer arithmetic.
  • D) It indicates inheritance.

Correct Answer: B) Accesses a member of a class through a pointer to an object of that class.

Explanation: The arrow operator (`->`) is used to access members (variables or functions) of a struct or class when you have a pointer to the object. `ptr->member` is a convenient shorthand for `(*ptr).member`.

ব্যাখ্যা: অ্যারো অপারেটর (`->`) একটি struct বা ক্লাসের সদস্যদের (ভেরিয়েবল বা ফাংশন) অ্যাক্সেস করতে ব্যবহৃত হয় যখন আপনার কাছে অবজেক্টের একটি পয়েন্টার থাকে। `ptr->member` হলো `(*ptr).member`-এর একটি সুবিধাজনক সংক্ষিপ্ত রূপ।

79. A “pure virtual function” in C++ is a virtual function that…

৭৯. C++ এ একটি “পিওর ভার্চুয়াল ফাংশন” হলো একটি ভার্চুয়াল ফাংশন যা…

  • A) Has no body/implementation in the base class.
  • B) Is initialized to zero.
  • C) Cannot be overridden.
  • D) Returns an integer.

Correct Answer: A) Has no body/implementation in the base class.

Explanation: A pure virtual function is declared by assigning `= 0` in its declaration, like `virtual void myFunction() = 0;`. This makes the class abstract and forces any concrete derived class to provide an implementation for that function.

ব্যাখ্যা: একটি পিওর ভার্চুয়াল ফাংশন তার ঘোষণায় `= 0` নির্ধারণ করে ঘোষণা করা হয়, যেমন `virtual void myFunction() = 0;`। এটি ক্লাসটিকে অ্যাবস্ট্রাক্ট করে তোলে এবং যেকোনো কঙ্ক্রিট ডিরাইভড ক্লাসকে সেই ফাংশনের জন্য একটি বাস্তবায়ন প্রদান করতে বাধ্য করে।

80. The first element of an array in C has an index of?

৮০. C-তে একটি অ্যারের প্রথম উপাদানের ইন্ডেক্স কত?

  • A) 1
  • B) 0
  • C) -1
  • D) It depends on the declaration

Correct Answer: B) 0

Explanation: C, C++, Java, and many other programming languages use zero-based indexing for arrays. This means the first element is at index 0, the second at index 1, and so on.

ব্যাখ্যা: C, C++, Java, এবং অন্যান্য অনেক প্রোগ্রামিং ভাষা অ্যারের জন্য শূন্য-ভিত্তিক ইন্ডেক্সিং ব্যবহার করে। এর মানে হলো প্রথম উপাদানটি ইন্ডেক্স 0-এ, দ্বিতীয়টি ইন্ডেক্স 1-এ, এবং এভাবেই চলতে থাকে।

81. What is the role of the `linker` in the C/C++ build process?

৮১. C/C++ বিল্ড প্রসেসে `লিঙ্কার`-এর ভূমিকা কী?

  • A) To translate source code to machine code.
  • B) To combine multiple object files and libraries into a single executable file.
  • C) To preprocess the source code.
  • D) To load the program into memory.

Correct Answer: B) To combine multiple object files and libraries into a single executable file.

Explanation: After the compiler translates source files into object files, the linker’s job is to take these object files, along with any required library code (like for `printf` or `cout`), and combine them to produce a final executable program.

ব্যাখ্যা: কম্পাইলার সোর্স ফাইলগুলিকে অবজেক্ট ফাইলে অনুবাদ করার পরে, লিঙ্কারের কাজ হলো এই অবজেক্ট ফাইলগুলিকে, প্রয়োজনীয় লাইব্রেরি কোডসহ (যেমন `printf` বা `cout` এর জন্য), একত্রিত করে একটি চূড়ান্ত এক্সিকিউটেবল প্রোগ্রাম তৈরি করা।

82. Which of the following data structures is non-linear?

৮২. নিচের কোন ডেটা স্ট্রাকচারটি নন-লিনিয়ার (non-linear)?

  • A) Stack
  • B) Array
  • C) Queue
  • D) Tree

Correct Answer: D) Tree

Explanation: Linear data structures like arrays, stacks, and queues store data sequentially. A tree is a non-linear data structure because it stores data in a hierarchical manner, with parent-child relationships.

ব্যাখ্যা: অ্যারে, স্ট্যাক এবং কিউ-এর মতো লিনিয়ার ডেটা স্ট্রাকচারগুলি ক্রমানুসারে ডেটা সংরক্ষণ করে। একটি ট্রি একটি নন-লিনিয়ার ডেটা স্ট্রাকচার কারণ এটি ডেটাকে একটি হায়ারারকিক্যাল পদ্ধতিতে, প্যারেন্ট-চাইল্ড সম্পর্কসহ সংরক্ষণ করে।

83. `goto` statement is generally considered harmful to program design because it…

৮৩. `goto` স্টেটমেন্টকে সাধারণত প্রোগ্রাম ডিজাইনের জন্য ক্ষতিকর বলে মনে করা হয় কারণ এটি…

  • A) is very slow.
  • B) can make program logic difficult to follow.
  • C) uses too much memory.
  • D) is not supported by modern compilers.

Correct Answer: B) can make program logic difficult to follow.

Explanation: The unrestricted use of `goto` can lead to unstructured code, often called “spaghetti code,” where the flow of control jumps around unpredictably. This makes the program extremely difficult to read, debug, and maintain.

ব্যাখ্যা: `goto`-এর অবাধ ব্যবহার অসংগঠিত কোড, যা প্রায়শই “স্প্যাগেটি কোড” নামে পরিচিত, তৈরি করতে পারে, যেখানে নিয়ন্ত্রণের প্রবাহ অপ্রত্যাশিতভাবে লাফিয়ে চলে। এটি প্রোগ্রামকে পড়া, ডিবাগ করা এবং রক্ষণাবেক্ষণ করা অত্যন্ত কঠিন করে তোলে।

84. What is a “namespace” in C++?

৮৪. C++ এ “নেমস্পেস” কী?

  • A) A region of memory.
  • B) A declarative region that provides a scope to identifiers (names of types, functions, variables, etc).
  • C) A synonym for a class.
  • D) A file containing code.

Correct Answer: B) A declarative region that provides a scope to identifiers (names of types, functions, variables, etc).

Explanation: Namespaces are used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries. For example, `std::cout` uses the `cout` identifier from the `std` namespace.

ব্যাখ্যা: নেমস্পেস কোডকে যৌক্তিক গোষ্ঠীতে সংগঠিত করতে এবং নামের সংঘর্ষ প্রতিরোধ করতে ব্যবহৃত হয়, যা বিশেষত যখন আপনার কোড বেসে একাধিক লাইব্রেরি থাকে তখন ঘটতে পারে। উদাহরণস্বরূপ, `std::cout` `std` নেমস্পেস থেকে `cout` আইডেন্টিফায়ার ব্যবহার করে।

85. The `char` data type in C is guaranteed to be how many bytes?

৮৫. C-তে `char` ডেটা টাইপ কত বাইটের হওয়ার নিশ্চয়তা দেওয়া হয়?

  • A) 1 byte
  • B) 2 bytes
  • C) 4 bytes
  • D) It is machine dependent.

Correct Answer: A) 1 byte

Explanation: By the C standard, `sizeof(char)` is always 1. A byte is defined as the amount of memory required to store a `char`, so a `char` is always one byte by definition, though the number of bits in that byte can vary (it’s almost always 8 bits on modern systems).

ব্যাখ্যা: C স্ট্যান্ডার্ড অনুযায়ী, `sizeof(char)` সবসময় 1। একটি বাইটকে একটি `char` সংরক্ষণ করার জন্য প্রয়োজনীয় মেমরির পরিমাণ হিসাবে সংজ্ঞায়িত করা হয়, তাই একটি `char` সংজ্ঞানুসারে সবসময় এক বাইটের হয়, যদিও সেই বাইটের বিটের সংখ্যা পরিবর্তিত হতে পারে (আধুনিক সিস্টেমে এটি প্রায় সবসময় 8 বিট)।

86. Dynamic polymorphism is achieved in C++ using…

৮৬. C++ এ ডাইনামিক পলিমরফিজম কী ব্যবহার করে অর্জন করা হয়?

  • A) Function overloading
  • B) Templates
  • C) Virtual functions
  • D) Operator overloading

Correct Answer: C) Virtual functions

Explanation: Dynamic (or runtime) polymorphism is the ability to decide which function to call at runtime. This is achieved in C++ through virtual functions and base class pointers/references. Function overloading and operator overloading are examples of static (compile-time) polymorphism.

ব্যাখ্যা: ডাইনামিক (বা রানটাইম) পলিমরফিজম হলো রানটাইমে কোন ফাংশন কল করতে হবে তা নির্ধারণ করার ক্ষমতা। এটি C++ এ ভার্চুয়াল ফাংশন এবং বেস ক্লাস পয়েন্টার/রেফারেন্সের মাধ্যমে অর্জন করা হয়। ফাংশন ওভারলোডিং এবং অপারেটর ওভারলোডিং হলো স্ট্যাটিক (কম্পাইল-টাইম) পলিমরফিজমের উদাহরণ।

87. Which of the following is not a preprocessor directive in C?

৮৭. নিচের কোনটি C-তে একটি প্রিপ্রসেসর ডিরেক্টিভ নয়?

  • A) `#define`
  • B) `#ifdef`
  • C) `#import`
  • D) `#include`

Correct Answer: C) `#import`

Explanation: `#define`, `#ifdef`, and `#include` are all standard C preprocessor directives. `#import` is a directive used in languages like Objective-C. It’s similar to `#include` but has guards to prevent multiple inclusions automatically.

ব্যাখ্যা: `#define`, `#ifdef`, এবং `#include` সবই স্ট্যান্ডার্ড C প্রিপ্রসেসর ডিরেক্টিভ। `#import` হলো Objective-C-এর মতো ভাষায় ব্যবহৃত একটি ডিরেক্টিভ। এটি `#include`-এর মতো কিন্তু স্বয়ংক্রিয়ভাবে একাধিকবার অন্তর্ভুক্তি রোধ করার জন্য গার্ড রয়েছে।

88. A class member declared with the `static` keyword…

৮৮. `static` কীওয়ার্ড দিয়ে ঘোষিত একটি ক্লাস সদস্য…

  • A) Belongs to a specific object of the class.
  • B) Belongs to the class itself, not to any object.
  • C) Can only be accessed by static functions.
  • D) Is automatically constant.

Correct Answer: B) Belongs to the class itself, not to any object.

Explanation: A static member (variable or function) is shared by all objects of the class. There is only one copy of the static member, regardless of how many objects are created. It exists even if no objects of the class are created.

ব্যাখ্যা: একটি স্ট্যাটিক সদস্য (ভেরিয়েবল বা ফাংশন) ক্লাসের সমস্ত অবজেক্ট দ্বারা শেয়ার করা হয়। স্ট্যাটিক সদস্যের শুধুমাত্র একটি কপি থাকে, যতগুলিই অবজেক্ট তৈরি করা হোক না কেন। ক্লাসের কোনো অবজেক্ট তৈরি না হলেও এর অস্তিত্ব থাকে।

89. The `switch` statement in C is a form of…

৮৯. C-তে `switch` স্টেটমেন্ট কীসের একটি রূপ?

  • A) Looping
  • B) Multi-way selection
  • C) Function call
  • D) Variable declaration

Correct Answer: B) Multi-way selection

Explanation: The `switch` statement provides a multi-way branch. It allows a variable to be tested for equality against a list of values (cases). It is often a more readable alternative to a series of `if-else if` statements.

ব্যাখ্যা: `switch` স্টেটমেন্ট একটি মাল্টি-ওয়ে ব্রাঞ্চ প্রদান করে। এটি একটি ভেরিয়েবলকে মানের একটি তালিকার (case) বিরুদ্ধে সমতার জন্য পরীক্ষা করার অনুমতি দেয়। এটি প্রায়শই `if-else if` স্টেটমেন্টের একটি সিরিজের চেয়ে বেশি পঠনযোগ্য বিকল্প।

90. A “template” in C++ allows you to…

৯০. C++ এ একটি “টেমপ্লেট” আপনাকে কী করতে দেয়?

  • A) Create a pre-formatted text file.
  • B) Define functions and classes that can operate with generic types.
  • C) Design a user interface.
  • D) Store a list of variables.

Correct Answer: B) Define functions and classes that can operate with generic types.

Explanation: Templates are a feature of C++ that allow functions and classes to be written for generic types. This allows you to write a single function or class that works with different data types (e.g., int, float, custom objects) without rewriting the code for each type.

ব্যাখ্যা: টেমপ্লেট হলো C++ এর একটি বৈশিষ্ট্য যা ফাংশন এবং ক্লাসগুলিকে জেনেরিক টাইপের জন্য লিখতে দেয়। এটি আপনাকে একটি একক ফাংশন বা ক্লাস লিখতে দেয় যা বিভিন্ন ডেটা টাইপের (যেমন, int, float, কাস্টম অবজেক্ট) সাথে কাজ করে, প্রতিটি টাইপের জন্য কোড পুনরায় না লিখে।

91. What is “type casting” in C?

৯১. C-তে “টাইপ কাস্টিং” কী?

  • A) Automatically converting a variable from one data type to another.
  • B) Manually converting a variable from one data type to another.
  • C) Checking the type of a variable.
  • D) Creating a new variable type.

Correct Answer: B) Manually converting a variable from one data type to another.

Explanation: Type casting (or explicit type conversion) is a way to manually convert a variable from one data type to another. For example, `(float)my_integer` converts the integer to a float for a specific operation.

ব্যাখ্যা: টাইপ কাস্টিং (বা এক্সপ্লিসিট টাইপ কনভার্সন) হলো ম্যানুয়ালি একটি ভেরিয়েবলকে এক ডেটা টাইপ থেকে অন্যটিতে রূপান্তর করার একটি উপায়। উদাহরণস্বরূপ, `(float)my_integer` একটি নির্দিষ্ট অপারেশনের জন্য ইন্টিজারটিকে ফ্লোটে রূপান্তর করে।

92. In C++, if a derived class redefines a base class member function, it is called…

৯২. C++ এ, যদি একটি ডিরাইভড ক্লাস একটি বেস ক্লাসের সদস্য ফাংশনকে পুনরায় সংজ্ঞায়িত করে, তবে তাকে কী বলা হয়?

  • A) Overloading
  • B) Overriding
  • C) Hiding
  • D) Overwriting

Correct Answer: B) Overriding

Explanation: Function overriding occurs when a derived class provides a specific implementation for a function that is already defined in its base class. For dynamic polymorphism, the base class function should be `virtual`.

ব্যাখ্যা: ফাংশন ওভাররাইডিং ঘটে যখন একটি ডিরাইভড ক্লাস একটি ফাংশনের জন্য একটি নির্দিষ্ট বাস্তবায়ন প্রদান করে যা তার বেস ক্লাসে ইতিমধ্যে সংজ্ঞায়িত আছে। ডাইনামিক পলিমরফিজমের জন্য, বেস ক্লাস ফাংশনটি `virtual` হওয়া উচিত।

93. Which primitive data structure would be most efficient for storing a simple list of student grades where frequent addition/removal at the end is required?

৯৩. ছাত্রদের গ্রেডের একটি সাধারণ তালিকা সংরক্ষণের জন্য কোন প্রিমিটিভ ডেটা স্ট্রাকচারটি সবচেয়ে কার্যকর হবে যেখানে শেষে ঘন ঘন যোগ/বিয়োগ করার প্রয়োজন হয়?

  • A) Array
  • B) Stack
  • C) Queue
  • D) Linked List

Correct Answer: B) Stack

Explanation: While an array or linked list could work, a stack is specifically designed for efficient LIFO (Last-In, First-Out) operations. Adding (push) and removing (pop) from the end of a stack are typically very efficient operations.

ব্যাখ্যা: যদিও একটি অ্যারে বা লিঙ্কড লিস্ট কাজ করতে পারে, একটি স্ট্যাক বিশেষভাবে কার্যকর LIFO (লাস্ট-ইন, ফার্স্ট-আউট) অপারেশনের জন্য ডিজাইন করা হয়েছে। স্ট্যাকের শেষে যোগ (পুশ) এবং বিয়োগ (পপ) করা সাধারণত খুব কার্যকর অপারেশন।

94. In the C statement `int *p[10];`, what is `p`?

৯৪. C স্টেটমেন্ট `int *p[10];`-এ, `p` কী?

  • A) A pointer to an array of 10 integers.
  • B) An array of 10 integer pointers.
  • C) A pointer to a pointer.
  • D) An illegal statement.

Correct Answer: B) An array of 10 integer pointers.

Explanation: Due to operator precedence, `[]` has higher precedence than `*`. So, `p` is first declared as an array of 10 elements (`p[10]`). The type of these elements is `int *` (pointer to integer). Thus, `p` is an array of 10 pointers to integers.

ব্যাখ্যা: অপারেটর প্রেসিডেন্সের কারণে, `[]`-এর অগ্রাধিকার `*`-এর চেয়ে বেশি। সুতরাং, `p` প্রথমে 10টি উপাদানের একটি অ্যারে (`p[10]`) হিসাবে ঘোষিত হয়। এই উপাদানগুলির টাইপ হলো `int *` (ইন্টিজারের পয়েন্টার)। সুতরাং, `p` হলো 10টি ইন্টিজার পয়েন্টারের একটি অ্যারে।

95. The concept that different classes can have methods with the same name but different implementations is called?

৯৫. বিভিন্ন ক্লাসের একই নামের কিন্তু ভিন্ন বাস্তবায়নের মেথড থাকার ধারণাকে কী বলা হয়?

  • A) Encapsulation
  • B) Abstraction
  • C) Polymorphism
  • D) Inheritance

Correct Answer: C) Polymorphism

Explanation: This is a classic description of polymorphism (specifically, via overriding). A base class can define a virtual function, and multiple derived classes can provide their own unique implementation for that function, all while being called through a common interface (a base class pointer).

ব্যাখ্যা: এটি পলিমরফিজমের (বিশেষত, ওভাররাইডিংয়ের মাধ্যমে) একটি ক্লাসিক বর্ণনা। একটি বেস ক্লাস একটি ভার্চুয়াল ফাংশন সংজ্ঞায়িত করতে পারে, এবং একাধিক ডিরাইভড ক্লাস সেই ফাংশনের জন্য তাদের নিজস্ব অনন্য বাস্তবায়ন প্রদান করতে পারে, সবই একটি সাধারণ ইন্টারফেসের (একটি বেস ক্লাস পয়েন্টার) মাধ্যমে কল করা হয়।

96. What is a “shallow copy” when copying objects?

৯৬. অবজেক্ট কপি করার সময় “শ্যালো কপি” কী?

  • A) A copy where only primitive types are copied.
  • B) A bit-by-bit copy of an object, where pointers in the new object point to the same memory locations as the original.
  • C) A copy where dynamically allocated memory is also duplicated for the new object.
  • D) A copy that is incomplete.

Correct Answer: B) A bit-by-bit copy of an object, where pointers in the new object point to the same memory locations as the original.

Explanation: A shallow copy simply copies the values of the data members. If a member is a pointer, only the pointer’s address is copied, not the data it points to. This can lead to problems, as both the original and copied object’s pointers will point to the same data. A “deep copy” solves this by allocating new memory for the copied object’s pointers.

ব্যাখ্যা: একটি শ্যালো কপি কেবল ডেটা সদস্যদের মান কপি করে। যদি কোনো সদস্য একটি পয়েন্টার হয়, তবে শুধুমাত্র পয়েন্টারের অ্যাড্রেস কপি করা হয়, এটি যে ডেটার দিকে নির্দেশ করে তা নয়। এটি সমস্যা তৈরি করতে পারে, কারণ মূল এবং কপি করা উভয় অবজেক্টের পয়েন্টার একই ডেটার দিকে নির্দেশ করবে। একটি “ডিপ কপি” কপি করা অবজেক্টের পয়েন্টারদের জন্য নতুন মেমরি বরাদ্দ করে এই সমস্যার সমাধান করে।

97. The `volatile` keyword in C tells the compiler that a variable…

৯৭. C-তে `volatile` কীওয়ার্ডটি কম্পাইলারকে বলে যে একটি ভেরিয়েবল…

  • A) cannot be changed.
  • B) is very important.
  • C) may be changed by something outside the normal program flow.
  • D) should be stored in a register.

Correct Answer: C) may be changed by something outside the normal program flow.

Explanation: `volatile` prevents the compiler from applying any optimizations on the variable that assume its value cannot change unexpectedly. It’s used for variables that can be modified by hardware, an interrupt service routine, or another thread.

ব্যাখ্যা: `volatile` কম্পাইলারকে ভেরিয়েবলের উপর কোনো অপটিমাইজেশন প্রয়োগ করা থেকে বিরত রাখে যা ধরে নেয় যে এর মান অপ্রত্যাশিতভাবে পরিবর্তন হতে পারে না। এটি এমন ভেরিয়েবলের জন্য ব্যবহৃত হয় যা হার্ডওয়্যার, একটি ইন্টারাপ্ট সার্ভিস রুটিন বা অন্য কোনো থ্রেড দ্বারা পরিবর্তিত হতে পারে।

98. Which of these is the correct way to initialize an array in C?

৯৮. C-তে একটি অ্যারে ইনিশিয়ালাইজ করার সঠিক উপায় কোনটি?

  • A) `int arr[3] = (1, 2, 3);`
  • B) `int arr[3] = {1, 2, 3};`
  • C) `int arr = {1, 2, 3};`
  • D) `int arr(3) = {1, 2, 3};`

Correct Answer: B) `int arr[3] = {1, 2, 3};`

Explanation: In C, arrays are initialized using a comma-separated list of values enclosed in curly braces `{}`. The size can often be omitted if the initializer list is present (e.g., `int arr[] = {1, 2, 3};`), and the compiler will deduce the size.

ব্যাখ্যা: C-তে, অ্যারেগুলি কার্লি ব্রেস `{}`-এর মধ্যে কমা দ্বারা পৃথক করা মানের তালিকা ব্যবহার করে ইনিশিয়ালাইজ করা হয়। যদি ইনিশিয়ালাইজার তালিকা উপস্থিত থাকে তবে আকারটি প্রায়শই বাদ দেওয়া যেতে পারে (যেমন, `int arr[] = {1, 2, 3};`), এবং কম্পাইলার আকারটি অনুমান করে নেবে।

99. A destructor in C++ has the same name as the class, preceded by a…

৯৯. C++ এ একটি ডেস্ট্রাক্টরের নাম ক্লাসের নামের সমান হয়, যার আগে একটি … থাকে।

  • A) `*` (asterisk)
  • B) `&` (ampersand)
  • C) `$` (dollar sign)
  • D) `~` (tilde)

Correct Answer: D) `~` (tilde)

Explanation: A destructor is a special member function used to deallocate memory and do other cleanup for a class object when its lifetime ends. Its name is the class name prefixed with a tilde (`~`). For example, the destructor for class `MyClass` would be `~MyClass()`.

ব্যাখ্যা: ডেস্ট্রাক্টর একটি বিশেষ সদস্য ফাংশন যা একটি ক্লাস অবজেক্টের জীবনকাল শেষ হলে মেমরি ডি-অ্যালোকেট করতে এবং অন্যান্য পরিচ্ছন্নতার কাজ করতে ব্যবহৃত হয়। এর নাম ক্লাসের নামের আগে একটি টিল্ড (`~`) চিহ্ন দিয়ে শুরু হয়। উদাহরণস্বরূপ, `MyClass` ক্লাসের জন্য ডেস্ট্রাক্টর হবে `~MyClass()`।

100. What is the main purpose of the “protected” access specifier in C++?

১০০. C++ এ “protected” অ্যাক্সেস স্পেসিফায়ারের প্রধান উদ্দেশ্য কী?

  • A) To make members accessible only within the same class.
  • B) To make members accessible to any part of the program.
  • C) To make members accessible within the class and to its derived classes, but not to the outside world.
  • D) To prevent members from being modified.

Correct Answer: C) To make members accessible within the class and to its derived classes, but not to the outside world.

Explanation: The `protected` access specifier is a key part of inheritance. A protected member is similar to a private member, but it can be accessed by derived (child) classes. This allows a base class to provide an interface for its derived classes while hiding the implementation details from the rest of the world.

ব্যাখ্যা: `protected` অ্যাক্সেস স্পেসিফায়ার ইনহেরিটেন্সের একটি গুরুত্বপূর্ণ অংশ। একটি প্রোটেক্টেড সদস্য একটি প্রাইভেট সদস্যের মতো, কিন্তু এটি ডিরাইভড (চাইল্ড) ক্লাস দ্বারা অ্যাক্সেস করা যায়। এটি একটি বেস ক্লাসকে তার ডিরাইভড ক্লাসগুলির জন্য একটি ইন্টারফেস প্রদান করার সুযোগ দেয় এবং বাকি বিশ্ব থেকে বাস্তবায়নের বিবরণ লুকিয়ে রাখে।

Scroll to Top