NEW
Font size
WorksheetsIT366_MAD_Prerequisite Exam
Total questions: 20
Worksheet time: 3600secs
class MyActivity
{
static Context context;
void onCreate(Context ctx)
{ context = ctx;
}}
What issue can arise?
Faster access
Compile-time error
Memory leak
Thread deadlock
Which code practice can cause ANR in Android apps?
Using ViewModel
Network call in main thread
Using RecyclerView
Using ConstraintLayout
int[] arr = new int[3];
System.out.println(arr[3]);
What happens?
Prints 0
Compilation error
ArrayIndexOutOfBoundsException
Logical error
A food delivery app extends features from a base User class to Customer and DeliveryPartner. This is an example of:
Polymorphism
Encapsulation
Inheritance
Abstraction
In a project, the same method login() behaves differently for Admin and User roles. Which concept is used?
Inheritance
Encapsulation
Polymorphism
Constructor
Why do product-based companies emphasize debugging and optimization skills during interviews?
Syntax can be memorized easily
Efficient code reduces infrastructure cost
Debugging reflects real-world problem-solving ability
UI design is less important
Replacing O(n2) algorithm with O(nlogn) primarily results in:
Faster compilation
Lower execution time for large inputs
Reduced memory usage always
Simpler code syntax
An app feature shows noticeable delay due to nested loops. Which improvement has the highest impact on performance?
Rewriting code in a different language
Reducing time complexity using efficient data structures
Adding more hardware resources
Increasing cache size only
While debugging, a developer wants to trace the sequence of method calls that led to a crash. Which tool is most useful?
Layout Inspector
Call Stack analysis
Resource Monitor
APK Analyzer
A destroyed Activity remains in memory due to a static reference. What long-term effect can this cause?
Immediate compilation failure
Gradual memory leak leading to app slowdown
Faster object creation
UI thread blocking
A complex UI uses multiple nested layouts and suffers from slow rendering. Which refactoring strategy is most effective?
Replace all layouts with FrameLayout
Flatten hierarchy using ConstraintLayout
Increase screen resolution
Add caching to XML files
class Test {
Test() {
this(10);
System.out.print("Default "); }
Test(int x) {
System.out.print("Param "); }}
public class Main {
public static void main(String[] args)
{ new Test(); }}
What is the output?
Default Param
Param Default
Param
Compilation error
An app crashes when dividing a number by zero during execution. This is an example of:
Syntax Error
Compile-time Error
Runtime Error
Logical Error
A mobile app occasionally becomes unresponsive during API calls. Which design decision best prevents this issue in production?
Increase UI thread priority
Execute network calls on background threads
Reduce API response size only
Delay UI rendering
A developer restricts direct access to sensitive user data and exposes only controlled update methods. What is the primary benefit?
Faster execution time
Improved data integrity and security
Reduced memory footprint
Simplified UI logic
A discount calculation logic is written as:
if price > 500:
discount = price * 0.10
else:
discount = price * 0.05
During sale, customers with price = 500 complain about wrong discount. What is the issue?
Syntax error
Runtime error
Boundary condition logical error
Data type mismatch
A variable is declared but assigned an incompatible data type in a strongly typed language. At which stage is this issue detected?
Lexical analysis due to token mismatch
Syntax analysis due to grammar violation
Semantic analysis due to type inconsistency
Runtime due to memory allocation
A shopping app calculates discounts correctly for most users but applies incorrect values during seasonal offers. The code runs without crashing. What best explains this issue?
Conditional logic fails for boundary cases
Compiler optimization removes required code
Runtime exception is silently ignored
UI rendering issue
A fintech company redesigns its app so that new payment methods can be added without modifying existing code. Which design principle is primarily applied?
Tight coupling through inheritance
Abstraction using interfaces
Encapsulation via private constructors
Method overloading for flexibility
A reference variable of type Payment points to objects of UPI, Card, and Wallet. At runtime, the correct pay() method is invoked. This behavior depends on:
Compile-time binding based on reference type
Runtime binding based on object type
Static method resolution
Constructor chaining
