Home / Roshan / Programming MCQs Solution
Programming Portal Solution
You will find all Programming Portal MCQs whose solution is updated by Roshan
Q. How should request data be accessed?
Q. What is a key design note of the Request class?
Q. Which method sets path variables internally?
Q. What is passed to the constructor of Request?
Q. Which method sets cookies internally?
Q. Which method returns the Session object?
Q. Which method is used internally to set headers?
Q. Which method provides access to HTTP headers?
Q. What happens if set_body() is called with null body?
Q. Which method sets the request body?
Q. What does the update() method do?
Q. Which method returns the client's IP address?
Q. Which method returns the request URL?
Q. How do you get path variables from the request?
Q. Which method is used to get cookies?
Q. Which method is used to retrieve session data?
Q. Which method returns the request body?
Q. How do you access a specific HTTP header?
Q. Which method is used to retrieve query parameters?
Q. What is the primary responsibility of the Request class in Trishul API?
Q. Which statement is true about Response class?
Q. What is correct usage to immediately return response?
Q. What does Response::json() NOT do?
Q. When should headers and cookies be set?
Q. What is a risk of using static properties in Response?
Q. What is a key design aspect of Response class?
Q. Which header is automatically set by json()?
Q. What does get_status_code() return?
Q. What does get_body() return?
Q. Which method is used to access session?
Q. Which method is used to set cookies?
Q. Which method is used to access cookies?
Q. Which method is used to access headers?
Q. Why is constructor private?
Q. What is the visibility of Response constructor?
Q. What happens if unsupported return type is passed to out()?
Q. What is the default return type of Response?
Q. Which method sends response and terminates execution?
Q. Which method creates a JSON response object?
Q. What is the main purpose of the Response class?
Q. Which is the correct usage?
Q. Why is class name included in logs?
Q. Where are logs stored by default?
Q. What happens if invalid log pattern is used?
Q. What happens if invalid directory is provided?
Q. What type is returned by get_logger()?
Q. What happens if log directory does not exist?
Q. How are log files named when directory is set?
Q. What is the format of log entry?
Q. What is included in each log entry?
Q. Which method logs error messages?
Q. Which method logs warning messages?
Q. Which log levels are supported?
Q. Which method is equivalent to info()?
Q. Which method logs INFO level message?
Q. What parameter is passed to get_logger()?
Q. Which method is used to get logger instance?
Q. What happens if set_log_dir() is NOT called?
Q. Which method is used to set custom log directory?
Q. What is the primary purpose of LoggerFactory?
Q. Which scenario may justify stopping execution in middleware?
Q. What is a key rule when implementing middleware?
Q. Which class is used in handle_response() parameter?
Q. Which class is used in handle_request() parameter?
Q. What can middleware modify?
Q. Which use case is NOT suitable for middleware?
Q. Should middleware terminate execution?
Q. Which method can modify response headers?
Q. Which method can modify request headers?
Q. What does middleware chaining mean?
Q. Which operation is suitable for handle_response()?
Q. Which operation is suitable for handle_request()?
Q. What happens if middleware does not return Request/Response?
Q. What must handle_response() return?
Q. What must handle_request() return?
Q. When is handle_response() executed?
Q. When is handle_request() executed?
Q. Which methods must be implemented in MiddlewareInterface?
Q. Which namespace contains MiddlewareInterface?
Q. What is MiddlewareInterface used for?
Q. Which exception scenario is handled by DB class?
Q. What is recommended usage of DB class?
Q. What happens on subsequent calls to get_connection()?
Q. Why is ERRMODE_EXCEPTION important?
Q. What is PDO error mode set to?
Q. Which class stores DB configuration?
Q. Which class is used internally to read environment variables?
Q. Which variable defines database password?
Q. Which variable defines database username?
Q. Which variable defines database port?
Q. Which variable defines database name?
Q. Which variable defines database host?
Q. What happens if unsupported DB type is provided?
Q. Which database types are supported?
Q. Which environment variable defines database type?
Q. What is the return type of get_connection()?
Q. Which method should be used to obtain DB connection?
Q. What happens if DB configuration is missing?
Q. Which design pattern is used by DB::get_connection()?
Q. What is the primary responsibility of the DB class?
Q. Which of the following is a correct usage?
Q. Which method enforces array type for data?
Q. Which method is used for PUT request (mono variant)?
Q. What happens inside __makeCurlRequest()?
Q. Which parameter is NOT optional in client methods?
Q. What is passed to __makeCurlRequest() as requestType?
Q. Which class is used to define headers?
Q. What is the return type of TrishulClient methods?
Q. Which method supports sending mixed data type?
Q. What is special about delete_flux() data parameter?
Q. Which method is used to send DELETE request (flux variant)?
Q. What is the visibility of __makeCurlRequest()?
Q. Which method internally executes the HTTP request?
Q. Which parameter type is required for headers in all methods?
Q. Which method is used for POST request (flux variant)?
Q. Which method is used for GET request (mono variant)?
Q. What is the main difference between mono and flux methods?
Q. Which technology is used internally by TrishulClient to make HTTP requests?
Q. Which interface does TrishulClient implement?
Q. What condition is required for softDelete() to work?
Q. Which method checks record count?
Q. Which method returns primary key?
Q. Which method returns table name?
Q. What is returned by queryBuilder()?
Q. Which relationship returns a single record?
Q. Which relationship represents many-to-one?
Q. Which relationship represents one-to-many?
Q. What happens if exception occurs inside transaction()?
Q. What is the purpose of transaction() method?
Q. Which method returns only one record using raw SQL?
Q. Which method executes raw SQL and returns multiple records?
Q. Which methods are aliases of find()?
Q. Which method performs soft delete?
Q. What is returned by getById($id)?
Q. What does Model::all() return?
Q. Which keyword correctly defines table name in Model v1.x?
Q. What type of class is TrishulApi\Core\Data\Model?
Q. Which component handles HTTP client calls?
Q. What type of logging is supported?
Q. Which method modifies request headers in middleware?
Q. What does set_env_path() do?
Q. Which method is used to update dependencies?
Q. What is the main benefit of LoggerFactory::get_instance()?
Q. What is the purpose of .env file?
Q. Where are dependencies stored in Trishul API?
Q. What does PDO::FETCH_ASSOC return?
Q. Which method executes SQL queries in DB class?
Q. What happens if middleware does not return Request in handle()?
Q. How are headers set in middleware response?
Q. Which method retrieves request body?
Q. Which method fetches query parameters from URL?
Q. What is returned when you define a route like Router::get('/hello', ['hello'=>'world'])?
Q. Which file is responsible for defining routes?
Q. What does get_swagger() return?
Q. What is the role of set_log_dir()?
Q. Which method is responsible for setting custom exception handling?
Q. What happens if start() is not called in index.php?
Q. Which property is mandatory in a custom model?
Q. Which of the following best describes Trishul Model?
Q. What is the main use of TrishulClient?
Q. What is returned by TrishulClient methods?
Q. Which method is used to make a GET request using TrishulClient?
Q. Which HTTP methods are supported by TrishulClient?
Q. Which namespace contains TrishulClient?
Q. Which class is used to make external API calls in Trishul API?
Q. What is the purpose of the Model class?
Q. Which database mechanism does the Model class use internally?
Q. Why is parent::__construct() called in the model constructor?
Q. Which property is used to override the primary key in a model?
Q. What is the default primary key in Trishul Model if not specified?
Q. Which property defines the table name in a Trishul model?
Q. Which class should be extended to create a model in Trishul API?
Q. What does DB::get_connection() return?
Q. Which class provides database connection?
Q. Which method modifies outgoing response in middleware?
Q. Which method modifies incoming request in middleware?
Q. What is the purpose of MiddlewareInterface?
Q. Which logging level method is NOT mentioned?
Q. Which class is used for logging?
Q. Which method is used to return JSON response?
Q. Which class is used to send JSON responses?
Q. Which method retrieves request headers?
Q. How is the Request object provided to controllers?
Q. Which class provides access to HTTP request data?
Q. How do you define a GET route in Trishul API?
Q. Which class is used to create routes?
Q. Which method should be called at the end of index.php?
Q. Which method is used to define allowed domains (CORS)?
Q. Which class is responsible for bootstrapping the application?
Q. What is the role of index.php in Trishul API?
Q. Which command starts the Trishul API application locally?
Q. Which command is used to create a new Trishul API project?
Q. What type of APIs can be built using Trishul API?
Q. Which layer does Trishul API mainly operate in?
Q. What is the benefit of using Trishul API framework?
Q. Which HTTP method is used to update existing resources?
Q. Which HTTP method is used to create new resources?
Q. Which HTTP method is commonly used to fetch data in Trishul API?
Q. What does REST stand for in Trishul API context?
Q. Which data format is most commonly used with Trishul API?
Q. Which protocol is typically used with Trishul API?
Q. What is the main purpose of using a framework like Trishul API?
Q. Which of the following best describes Trishul API?
Q. What type of architecture does Trishul API follow?
Q. When was Trishul API version 1.0.0 launched?
Q. Which programming language is Trishul API built on?
Q. What is Trishul API primarily used for?
Q. Which keyword is used to create object?
Q. Which method is used to compare strings lexicographically?
Q. Which of these supports multiple inheritance?
Q. Which keyword prevents method overriding?
Q. Which exception is thrown when array index is invalid?
Q. Which of these is marker interface?
Q. Which method is called automatically during object destruction?
Q. Which class is used for dynamic array?
Q. Which keyword is used to define a constant?
Q. Which access modifier is most restrictive?
Q. What is garbage collection?
Q. Which method is used to stop a thread?
Q. Which keyword is used to call parent constructor?
Q. Which exception occurs when dividing by zero?
Q. Which operator is used for object comparison?
Q. Which collection is synchronized?
Q. Which method is used to start a thread?
Q. Which keyword is used to create a thread?
Q. Which memory area stores class metadata?
Q. What is the size of int in Java?
Q. Which exception is unchecked?
Q. Which keyword is used to refer to current object?
Q. Which of the following is thread-safe?
Q. Which keyword is used for abstraction?
Q. What is method overloading?
Q. Which of these is not a primitive type?
Q. Which interface is implemented by ArrayList?
Q. Which keyword is used to prevent inheritance?
Q. Which collection does not allow duplicates?
Q. Which of these is used to handle exceptions?
Q. Which method is the entry point of a Java program?
Q. Which of the following is not a Java feature?
Q. Which keyword is used to inherit a class in Java?
Q. What is the default value of an int variable in Java?
Q. Which of the following improves performance in PHP?
Q. What is the purpose of traits in PHP?
Q. Which function is used to hash passwords securely?
Q. Which superglobal is used to store session data?
Q. Which keyword is used for late static binding?
Q. What is the main purpose of PDO in PHP?
Q. Which function prevents XSS attacks?
Q. What will be the output? var_dump(5 == "5");
Q. Which superglobal contains server information?
Q. What will be the output? echo "Hello" . " World";
Q. Which of the following is a loop structure in PHP?
Q. Which function is used to connect to MySQL in PHP (modern way)?
Q. Which function is used to get string length?
Q. Which of the following is used to start a session?
Q. Which function is used to include a file in PHP?
Q. What will be the output? $a = 5; $b = 10; echo $a + $b;
Q. Which superglobal is used to collect form data sent via POST?