Security Printing Corporation (Bangladesh) Ltd. Sub-Assistant Programmer Exam: 2022প্রশ্ন ও সমাধান
- Set by
- Security Printing Corporation
- Post
- Assistant Programmer
- Exam date
- 2022
- Questions
- 12 (0 MCQ, 12 written)
- Exam guide
- Government IT officer posts · সরকারি প্রতিষ্ঠানের আইটি পদ
- Programming · প্রোগ্রামিং 5
- Cyber Security · সাইবার নিরাপত্তা 3
- Operating Systems · অপারেটিং সিস্টেম 2
- Data Structures · ডেটা স্ট্রাকচার 1
- General ICT · সাধারণ আইসিটি 1
What is Blacklist and Whitelist? Write down the difference between Black list and White list.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is difference between exception and error in Java?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is exception handling? Write with an example.
Model answer
Direct answer: Exception handling is a mechanism that lets a program detect and gracefully respond to runtime errors (exceptions) instead of crashing — using try (code that might fail), catch (recovery logic), and finally (cleanup that always runs).
public class DivisionExample {
public static void main(String[] args) {
int a = 10, b = 0;
try {
int result = a / b; // throws ArithmeticException
System.out.println("Result: " + result);
} catch (ArithmeticException e) {
System.out.println("Error: Cannot divide by zero.");
} finally {
System.out.println("Division attempt finished.");
}
}
}
Output:
Error: Cannot divide by zero.
Division attempt finished.
How it works:
- The try block contains code that might throw an exception (a/b throws ArithmeticException when b=0).
- The matching catch block intercepts that specific exception type and handles it instead of letting the JVM terminate the program.
- The finally block always executes — whether or not an exception occurred — used for cleanup like closing files or releasing resources.
- Custom exceptions can also be created (extends Exception) and raised explicitly with
throw, with methods declaring them viathrows.
Exam takeaway: try isolates risky code, catch recovers from a specific exception type, and finally guarantees cleanup — this three-part structure is the foundation of robust Java error handling.
What is SQL injection? How to prevent it?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is Cross site script XSS and how can fix it?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Write short note on Virtual Memory and Cache memory.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Describe Dynamic memory allocation in programming in C?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between Data and Information.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between High level languages and low level language with some example?
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
Difference between LIFO and FIFO in data structure.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is kernel? Write down the objectives of kernel.
Sign up free to see the model answer · উত্তর দেখতে বিনামূল্যে সাইন আপ করুন
What is nested structure in C programming? Explain with example.
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 · Government IT officer posts guide