Programming MCQs Feed

📊 Trishul API
Q. How are log files named when directory is set?
  • (A) log.txt
  • (B) app.log
  • (C) YYYY-MM-DD.log
  • (D) logs.json
💬 Discuss
✅ Correct Answer: (C) YYYY-MM-DD.log

Explanation: Daily log files are created.

📊 Trishul API
Q. What happens if log directory does not exist?
  • (A) Error thrown
  • (B) Logs ignored
  • (C) Directory created automatically
  • (D) Fallback to root
💬 Discuss
✅ Correct Answer: (C) Directory created automatically

Explanation: Directory is auto-created.

📊 Trishul API
Q. What type is returned by get_logger()?
  • (A) Logger
  • (B) LoggerFactory
  • (C) PDO
  • (D) Array
💬 Discuss
✅ Correct Answer: (B) LoggerFactory

Explanation: Returns LoggerFactory instance.

📊 Trishul API
Q. What happens if invalid directory is provided?
  • (A) Ignored
  • (B) Default used
  • (C) Exception thrown
  • (D) Warning only
💬 Discuss
✅ Correct Answer: (C) Exception thrown

Explanation: Invalid directory causes exception.

📊 Trishul API
Q. What happens if invalid log pattern is used?
  • (A) Ignored
  • (B) Logged incorrectly
  • (C) Exception thrown
  • (D) Fallback applied
💬 Discuss
✅ Correct Answer: (C) Exception thrown

Explanation: Docs mention exception is thrown.

📊 Trishul API
Q. Where are logs stored by default?
  • (A) logs/ folder
  • (B) Database
  • (C) PHP error log
  • (D) Memory
💬 Discuss
✅ Correct Answer: (C) PHP error log

Explanation: Default logging is PHP error log.

📊 Trishul API
Q. Why is class name included in logs?
  • (A) For styling
  • (B) For debugging context
  • (C) For performance
  • (D) For UI display
💬 Discuss
✅ Correct Answer: (B) For debugging context

Explanation: Helps trace log source.

📊 Trishul API
Q. Which is the correct usage?
Code:
$logger = LoggerFactory::get_logger('MyClass');
  • (A) Correct
  • (B) Incorrect - missing directory
  • (C) Incorrect - wrong method
  • (D) Incorrect - wrong parameter
💬 Discuss
✅ Correct Answer: (A) Correct

Explanation: This is correct usage.

📊 Trishul API
Q. What is MiddlewareInterface used for?
  • (A) Database operations
  • (B) Intercepting HTTP requests and responses
  • (C) Routing requests
  • (D) Generating UI
💬 Discuss
✅ Correct Answer: (B) Intercepting HTTP requests and responses

Explanation: Middleware intercepts requests and responses.

📊 Trishul API
Q. Which namespace contains MiddlewareInterface?
  • (A) TrishulApi\Core\Http
  • (B) TrishulApi\Core\Middleware
  • (C) TrishulApi\Core\Data
  • (D) TrishulApi\Core\App
💬 Discuss
✅ Correct Answer: (B) TrishulApi\Core\Middleware

Explanation: It belongs to Core\Middleware namespace.