MCQ Bank
What is a potential issue with a class having too many dependencies?
- A) It improves code maintainability and flexibility
- B) It increases code reusability and modularity
- C) It leads to high coupling and reduces testability
- D) It enhances code readability and reduces complexity
Which of the following is a bad practice for class design?
- A) Following the open-closed principle for class extension
- B) Using appropriate access modifiers for class members
- C) Having a class with only a single responsibility
- D) Overusing global variables within a class
What is the purpose of the final keyword in the following Java code snippet? public class Calculator { public static final double PI = 3.14159; public double calculateCircleArea(double radius) { return PI * radius * radius; } public static void main(String[] args) { Calculator calculator = new Calculator(); double area = calculator.calculateCircleArea(5); System.out.println("Area: " + area); } }
- A) It indicates that the PI variable cannot be changed.
- B) It prevents the area variable from being modified within the main method.
- C) It specifies that the calculateCircleArea method cannot be overridden.
- D) It ensures that the Calculator class cannot be extended.
Which of the following is a good practice for handling dynamic memory allocation in C++?
- A) Ignoring exception handling during memory allocation
- B) Utilizing smart pointers or RAII techniques
- C) Using raw pointers without explicit memory deallocation
- D) Relying on the operating system to automatically deallocate memory
What will be the output of the following code? #include <iostream> #include <vector> void modifyVector(std::vector<int>& vec) { vec.push_back(10); } int main() { std::vector<int> numbers; modifyVector(numbers); std::cout << numbers.size() << std::endl; return 0; }
- A) 1
- B) Compilation error
- C) 10
- D) 0
According to the MISRA C++ coding standard, why is it recommended to avoid dynamic memory allocation whenever possible?
- A) Dynamic memory allocation simplifies resource management.
- B) Dynamic memory allocation is more efficient than stack-based allocation.
- C) Dynamic memory allocation improves code readability.
- D) Dynamic memory allocation can lead to memory leaks and unpredictable behavior.
Which keyword is used in C++ to mark a function or destructor as non-throwing?
- A) noexcept
- B) noexception
- C) nonthrowing
- D) nothrow
What does the noexcept keyword signify in C++?
- A) The function will throw an exception.
- B) The function will handle exceptions internally.
- C) The function will not throw any exceptions.
- D) The function will ignore exception handling.
What is the potential risk associated with dynamic memory allocation?
- A) Increased program efficiency
- B) Deterministic behavior
- C) Improved code safety and reliability
- D) Resource exhaustion and memory leaks
What will be the output of the following code? #include <iostream> int main() { int* ptr = new int(5); std::cout << *ptr << std::endl; delete ptr; std::cout << *ptr << std::endl; return 0; }
- A) 5 and a runtime error
- B) 5 and a segmentation fault
- C) Compilation error
- D) 5 and a runtime error
Which aspect of software testing can be automated using Testing Tools?
- A) User interface design testing
- B) Performance testing
- C) Compatibility testing
- D) Documentation testing
What is one benefit of using Software Documentation Tools?
- A) Enhanced user interface design
- B) Improved data security
- C) Increased software development speed
- D) Streamlined project management
Which of the following is a feature commonly found in Software Documentation Tools?
- A) Code debugging capabilities
- B) Code debugging capabilities
- C) Data visualization tools
- D) Version control
How do Software Documentation Tools improve communication within development teams?
- A) By generating automated code documentation
- B) By automating software testing processes
- C) By integrating project management tools
- D) By providing real-time collaboration features
How can Testing Tools help teams ensure compliance with industry standards and regulations?
- A) By generating comprehensive test reports
- B) By providing real-time collaboration features
- C) By offering code analysis and static testing capabilities
- D) By automating the process of bug tracking
What is one benefit of using Testing Tools in software development?
- A) Increased development speed
- B) Improved collaboration between developers and testers
- C) Streamlined project management
- D) Enhanced data security
What is an Epic in JIRA?
- A) A high-priority bug
- B) A software module
- C) A user story with a long timeline
- D) A JIRA user role
Which of the following is NOT a JIRA issue type?
- A) Server
- B) Task
- C) Bug
- D) Story
How are JIRA issues categorized?
- A) By status
- B) By priority
- C) By assignee
- D) By file format
What is JIRA?
- A) A data analysis software
- B) An operating system
- C) A project management tool
- D) A programming language