Docsity

Delphi Master Developer Latest Practice Exam (Updated Edition), Exams of Technology

Toggle sidebar
bg1
Delphi Master Developer Latest
Practice Exam (Updated Edition)
Q1.
A generic classTCache<T: class, constructor>lazily creates instances. Which
issue is most likely if used across multiple threads without synchronization?
A. Constructor constraint violation
B. AV due to nil dereference
C. Double-creation and memory leaks
D. RTTI corruption
Answer:C
Explanation:Without locking, multiple threads may pass the nil check and
create duplicate instances, causing leaks or inconsistent state.
Q2.
What is the key difference
betweenTObjectList<T>withOwnsObjects=TrueandTList<T>?
A. Thread safety
B. Automatic freeing of contained objects
C. Faster iteration
D. Support for generics constraints
Answer:B
Explanation:TObjectList<T>manages object lifetimes, automatically freeing
them when removed or destroyed.
Q3.
Which RTTI feature allows invocation of a method dynamically by name?
A. TRttiField
B. TRttiMethod.Invoke
C. TValue.Cast
D. TypInfo.GetPropInfo
Answer:B
Explanation:TRttiMethod.Invokeenables runtime method execution via
reflection.
Q4.
What is the main risk of using anonymous methods capturing local variables?
A. Stack overflow
B. Dangling references due to extended lifetime
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c

Partial preview of the text

Download Delphi Master Developer Latest Practice Exam (Updated Edition) and more Exams Technology in PDF only on Docsity!

Practice Exam (Updated Edition)

Q1.

A generic class TCache lazily creates instances. Which issue is most likely if used across multiple threads without synchronization? A. Constructor constraint violation B. AV due to nil dereference C. Double-creation and memory leaks D. RTTI corruption Answer: C Explanation: Without locking, multiple threads may pass the nil check and create duplicate instances, causing leaks or inconsistent state. Q2. What is the key difference between TObjectList with OwnsObjects=True and TList? A. Thread safety B. Automatic freeing of contained objects C. Faster iteration D. Support for generics constraints Answer: B Explanation: TObjectList manages object lifetimes, automatically freeing them when removed or destroyed. Q3. Which RTTI feature allows invocation of a method dynamically by name? A. TRttiField B. TRttiMethod.Invoke C. TValue.Cast D. TypInfo.GetPropInfo Answer: B Explanation: TRttiMethod.Invoke enables runtime method execution via reflection. Q4. What is the main risk of using anonymous methods capturing local variables? A. Stack overflow B. Dangling references due to extended lifetime

Practice Exam (Updated Edition)

C. Compiler optimization issues D. Type mismatch Answer: B Explanation: Captured variables may outlive their scope, leading to undefined behavior if not managed. Q5. In Delphi memory management, what does FreeAndNil guarantee? A. Object memory zeroing B. Prevents double-free and clears reference C. Calls destructor twice D. Forces garbage collection Answer: B Explanation: It frees the object and sets the reference to nil, avoiding dangling pointers. Q6. Which DataSnap component is responsible for server-side method exposure? A. TSQLConnection B. TDSServerClass C. TClientDataSet D. TFDQuery Answer: B Explanation: TDSServerClass binds server methods to DataSnap clients. Q7. What is a key benefit of FireDAC over dbExpress? A. Simpler API B. Cross-platform support C. Advanced connection pooling and caching D. Lower memory usage Answer: C Explanation: FireDAC offers robust pooling, caching, and high-performance features. Q8.

Practice Exam (Updated Edition)

Which mechanism allows custom attributes in Delphi? A. Interfaces B. RTTI with TCustomAttribute C. Generics D. Variant types Answer: B Explanation: Attributes extend metadata using RTTI. Q13. What is the purpose of Supports() in Delphi? A. Typecasting generics B. Checking interface implementation C. Memory allocation D. SQL validation Answer: B Explanation: It verifies and retrieves interface references safely. Q14. Which FireDAC feature improves batch insert performance? A. CachedUpdates B. Array DML C. LiveBindings D. FetchOptions Answer: B Explanation: Array DML allows bulk operations efficiently. Q15. What is the primary purpose of Delphi packages? A. Database connection B. Code modularization and runtime sharing C. Thread management D. UI rendering Answer: B Explanation: Packages allow modular deployment and shared libraries. Q16.

Practice Exam (Updated Edition)

What is a key difference between DLL and BPL? A. Language support B. BPL supports Delphi RTTI and packages C. DLLs are faster D. BPL cannot export functions Answer: B Explanation: BPL integrates with Delphi runtime and component model. Q17. Which construct ensures thread-safe singleton creation? A. global variable B. TMonitor.Enter/Exit C. TObject.Free D. RTTI Answer: B Explanation: Monitor ensures synchronization across threads. Q18. What is the advantage of using interfaces for memory management? A. Faster execution B. Reference counting C. Lower memory usage D. Better SQL performance Answer: B Explanation: Interfaces automatically manage lifetime via reference counting. Q19. Which DataSnap transport is commonly used for REST communication? A. TCP/IP B. HTTP/HTTPS C. Named Pipes D. COM Answer: B Explanation: REST-based DataSnap uses HTTP/HTTPS. Q20.

Practice Exam (Updated Edition)

Which FireDAC option controls fetch size? A. ResourceOptions B. FetchOptions C. UpdateOptions D. FormatOptions Answer: B Explanation: FetchOptions defines how data is retrieved. Q25. What is the benefit of using inline functions in Delphi? A. Runtime polymorphism B. Reduced function call overhead C. Better RTTI D. Automatic threading Answer: B Explanation: Inline reduces call overhead, improving performance in tight loops. Q26. When using TDictionary in a high-frequency lookup scenario, what is the main performance consideration? A. Memory alignment B. Hash function quality C. Object ownership D. Thread priority Answer: B Explanation: Poor hash distribution leads to collisions, degrading performance from O(1) toward O(n). Q27. What is the effect of {$RTTI EXPLICIT METHODS([])}? A. Enables full RTTI B. Disables RTTI for methods C. Enables generics only D. Removes attributes Answer: B Explanation: It explicitly disables RTTI generation for methods, reducing binary size.

Practice Exam (Updated Edition)

Q28.

In anonymous methods, what ensures captured variables remain valid? A. Stack allocation B. Heap promotion of captured variables C. Compiler optimization D. Reference counting Answer: B Explanation: Captured variables are promoted to heap storage to extend their lifetime. Q29. Which scenario most likely causes a memory leak in Delphi? A. Using TObjectList with OwnsObjects B. Circular interface references C. Using generics D. Inline methods Answer: B Explanation: Reference counting cannot resolve circular dependencies. Q30. What is the role of IDataSetProvider in multi-tier architecture? A. Executes SQL B. Bridges dataset between server and client C. Manages UI D. Handles threading Answer: B Explanation: It packages data for transport between tiers. Q31. Which FireDAC feature allows offline data editing? A. LiveBindings B. CachedUpdates C. FetchOptions D. ResourceOptions

Practice Exam (Updated Edition)

Answer: B Explanation: Indicates component is in design mode. Q36. Which is true about TInterfacedObject? A. No reference counting B. Automatic reference counting C. Only for UI components D. Cannot be inherited Answer: B Explanation: Implements IInterface with reference counting. Q37. What is a potential issue when mixing object references and interfaces? A. Compile-time error B. Double-free or premature destruction C. SQL failure D. UI flicker Answer: B Explanation: Interface ref-counting may destroy objects unexpectedly. Q38. Which DataSnap feature supports stateless server calls? A. Session management B. REST transport C. TClientDataSet D. BPL Answer: B Explanation: REST calls are inherently stateless. Q39. What is the main purpose of TThread.Queue? A. Background execution B. Deferred execution on main thread without blocking C. Memory allocation D. Synchronization lock

Practice Exam (Updated Edition)

Answer: B Explanation: Queues execution to main thread asynchronously. Q40. Which SQL practice improves FireDAC performance? A. Dynamic SQL everywhere B. Parameterized queries C. Using SELECT * D. Avoid indexes Answer: B Explanation: Reduces parsing overhead and improves plan reuse. Q41. What is the role of TFieldDefs? A. Stores runtime data B. Defines dataset structure C. Executes SQL D. Manages threads Answer: B Explanation: Describes field metadata before dataset creation. Q42. Which method loads RTTI context? A. TRttiMethod.Create B. TRttiContext.Create C. TValue.Create D. TObject.Create Answer: B Explanation: Entry point for RTTI operations. Q43. What is the purpose of FreeNotification? A. Prevent memory leak B. Notify dependent components of destruction C. Improve performance D. Enable RTTI

Practice Exam (Updated Edition)

Answer: C Explanation: Base class for all custom attributes. Q48. What does SetLength do for dynamic arrays? A. Frees memory B. Allocates/resizes array C. Sorts array D. Locks memory Answer: B Explanation: Adjusts array size dynamically. Q49. What is the purpose of TMonitor? A. UI rendering B. Thread synchronization C. SQL execution D. Memory allocation Answer: B Explanation: Provides locking mechanism. Q50. Which issue arises from excessive RTTI usage? A. Compilation failure B. Performance overhead C. Memory corruption D. SQL errors Answer: B Explanation: Reflection is slower than static calls and can impact performance if overused. Q51. When implementing a custom comparer for TDictionary, which interface must be used? A. IComparer B. IEqualityComparer

Practice Exam (Updated Edition)

C. ICustomComparer D. IHashProvider Answer: B Explanation: TDictionary relies on IEqualityComparer for both equality checks and hash code generation. Q52. What is the consequence of an inconsistent GetHashCode implementation? A. Compilation error B. Dictionary access violations C. Incorrect key lookups or duplicates D. Slower RTTI Answer: C Explanation: If equal objects produce different hashes, dictionary behavior becomes unreliable. Q53. Which constraint ensures a generic type has a parameterless constructor? A. class B. record C. constructor D. new Answer: C Explanation: Delphi uses the constructor constraint for this purpose. Q54. What is a key benefit of TArray.Sort with a custom comparer? A. Memory allocation B. Flexible sorting logic C. Thread safety D. RTTI support Answer: B Explanation: Allows domain-specific sorting without modifying the type. Q55. Which FireDAC feature enables connection reuse across threads?

Practice Exam (Updated Edition)

A. Thread safety B. Copy-on-write behavior C. UTF-8 encoding D. Memory alignment Answer: B Explanation: Ensures a unique copy before modification. Q60. What is the role of PChar in modern Delphi? A. Deprecated type B. Pointer to null-terminated string C. Generic container D. Thread-safe string Answer: B Explanation: Used for interoperability with C APIs. Q61. Which issue arises from improper pointer arithmetic? A. Compilation error B. Memory corruption C. RTTI failure D. SQL issues Answer: B Explanation: Incorrect pointer manipulation leads to undefined behavior. Q62. What is the purpose of Move procedure? A. Memory allocation B. Copy raw memory blocks C. Object cloning D. SQL transfer Answer: B Explanation: Performs fast memory copying. Q63. Which RTL structure is optimized for thread-safe queues?

Practice Exam (Updated Edition)

A. TList B. TQueue C. TThreadedQueue D. TObjectList Answer: C Explanation: Provides built-in synchronization. Q64. What is a key limitation of TThreadedQueue? A. No generics B. Blocking behavior under contention C. Memory leaks D. No thread support Answer: B Explanation: Threads may block if queue is full/empty. Q65. Which method is used to define a custom property editor in VCL? A. RegisterComponent B. RegisterPropertyEditor C. DefineProperties D. CreateEditor Answer: B Explanation: Registers design-time property editors. Q66. What is the significance of GetPropList in RTTI? A. Executes methods B. Retrieves property metadata C. Allocates memory D. Sorts properties Answer: B Explanation: Used for runtime property inspection. Q67. Which FireDAC option controls auto-fetching of records?

Practice Exam (Updated Edition)

A. Compilation error B. Improper initialization or AV C. SQL failure D. Thread deadlock Answer: B Explanation: Missing inherited calls can break initialization. Q72. What is a benefit of using interfaces in multi-tier design? A. Faster execution B. Loose coupling C. Lower memory usage D. Simpler UI Answer: B Explanation: Interfaces decouple implementation from usage. Q73. Which FireDAC feature helps detect conflicts during updates? A. CachedUpdates B. UpdateOptions.LockMode C. FetchOptions D. ResourceOptions Answer: B Explanation: Locking strategies help manage concurrency. Q74. What is the role of TValue.From? A. SQL conversion B. Wrap value into RTTI container C. Memory allocation D. Thread creation Answer: B Explanation: Converts a typed value into TValue. Q75. Which scenario benefits most from using packages (BPL)?

Practice Exam (Updated Edition)

A. Small standalone apps B. Plugin-based architecture C. Single-threaded apps D. Simple scripts Answer: B Explanation: Packages allow dynamic module loading and extensibility. Q76. In FMX, what is the role of the scene graph? A. SQL execution B. UI hierarchy and rendering structure C. Memory management D. Thread pooling Answer: B Explanation: FMX uses a scene graph to represent and render UI elements hierarchically. Q77. What is a key difference between VCL and FMX rendering? A. VCL uses GPU, FMX uses CPU B. VCL is message-based, FMX is scene-based C. FMX does not support styles D. VCL is cross-platform Answer: B Explanation: VCL relies on Windows messages; FMX uses a scene graph with GPU acceleration. Q78. Which FMX feature enables dynamic UI appearance changes? A. RTTI B. Styles C. Packages D. DataSnap Answer: B Explanation: Styles define the look and feel independently of logic. Q79.