1. Home
  2. Subjects
  3. Computer Science MCQs

Computer Science MCQs

992 multiple choice questions with answers across 24 topics.

Embarking on the vast digital realm, Computer Science is a journey of discovery. It delves into crafting intelligent systems, solving problems through software, and extends to the realm of Artificial Intelligence—teaching computers language understanding and image recognition. Beyond coding, it encompasses database management, utilizing extensive data sets, and ensuring technology serves us optimally.

Computer Scientists contribute to networks, safeguarding information, and enhancing user-friendliness in technology applications, from phone apps to websites. Upholding ethical standards, we prioritize fairness, safety, and privacy. As technology evolves, Computer Science evolves with it, continually enhancing our digital landscape. Join us on this exciting journey into the future of a better, more inclusive digital world!

Showing 1–25 of 992

DBMS stands for:

  1. Database Management System Correct answer
  2. Data Management System
  3. Database Manipulation System
  4. Data Manipulation System
MCQSEXAM Read explanation

A CloudFront distribution has a default TTL of 86400 seconds and a minimum TTL of 0. The origin sends Cache-Control: max-age=300. For how long does CloudFront cache the object?

  1. 86400 seconds, because the distribution default takes precedence always
  2. 0 seconds, because the minimum TTL allows revalidation on every request
  3. 300 seconds, but only when the viewer sends no conditional headers
  4. 300 seconds, because the origin header overrides the default TTL value Correct answer
MCQSEXAM Read explanation

A Route 53 failover routing policy has primary and secondary records configured. What causes traffic to switch to the secondary?

  1. A latency increase above the threshold set in the routing policy
  2. The TTL of the primary record expiring without a refresh from the zone
  3. The health check on the primary record failing its configured checks Correct answer
  4. The primary record being deleted from the hosted zone by an operator
MCQSEXAM Read explanation

A private subnet needs outbound internet access for software updates but must not accept inbound connections. What is required?

  1. A NAT gateway inside the private subnet with an elastic IP attached to it
  2. A VPC endpoint for the internet that proxies every outbound HTTPS request
  3. A NAT gateway in a public subnet, plus a route in the private route table Correct answer
  4. An internet gateway attached to the private subnet's own route table
MCQSEXAM Read explanation

An API Gateway REST API integrates with a Lambda function that takes 40 seconds to finish. What does the client receive?

  1. A 502 error, because Lambda rejects runs longer than 30 seconds
  2. A 504 only if reserved concurrency has been configured on the function
  3. A 504 timeout, because the integration timeout is capped at 29 seconds Correct answer
  4. A 200 response after 40 seconds, since the gateway waits for the backend
MCQSEXAM Read explanation

A presigned S3 URL was generated using credentials from an IAM role that is deleted shortly afterwards. What happens when the URL is used before its expiry time?

  1. It works until expiry, since the signature alone authorises the request
  2. It works only for HEAD requests, because GET needs live credentials
  3. It fails only if the object's ETag changes after the URL was generated
  4. It fails, because the signing credentials must still be valid when used Correct answer
MCQSEXAM Read explanation

A user's identity policy allows s3:GetObject on a bucket, but the bucket policy contains an explicit Deny for that user. What is the result of the request?

  1. Denied only if the bucket policy also lists that user in a NotPrincipal element
  2. Allowed, because both statements are evaluated and the allow matches first
  3. Denied, because an explicit deny anywhere in IAM always overrides any allow Correct answer
  4. Allowed, because identity policies take precedence over resource policies
MCQSEXAM Read explanation

typeid(*basePtr) is evaluated where Base has no virtual functions and the object is really a Derived. What type is reported?

  1. The static type Base, because typeid ignores the dynamic type here Correct answer
  2. The dynamic type Derived, since typeid always inspects the vtable
  3. A std::bad_typeid exception, since the base class is not polymorphic
  4. The most-derived type, but only after a dynamic_cast has been performed
MCQSEXAM Read explanation

Why does the copy-and-swap assignment operator provide the strong exception guarantee?

  1. Swapping uses move assignment, which the standard requires to be noexcept
  2. The old state is replaced only after the copy has been fully constructed Correct answer
  3. The copy constructor cannot throw once the source object has been locked
  4. It avoids allocating memory, so no allocation failure can occur at all
MCQSEXAM Read explanation

A shared_ptr is built as std::shared_ptr<int>(new int[10]). What happens when the last reference to it goes away?

  1. Plain delete is called on the array pointer, which is undefined behaviour Correct answer
  2. delete[] is chosen automatically because the pointer type is an array
  3. The control block detects the array and calls the array deleter for you
  4. Nothing is freed, because shared_ptr never deletes array allocations at all
MCQSEXAM Read explanation

Inside a function template, what happens to the branch of an if constexpr whose condition is false for a given instantiation?

  1. It is removed before parsing, so even syntax errors in it are ignored
  2. It is compiled and executed at run time only if its condition is true
  3. It is discarded and not instantiated, so dependent code there may be invalid Correct answer
  4. It is still instantiated and type-checked, then removed later as a dead branch
MCQSEXAM Read explanation

A class holds a std::unique_ptr<Impl> member and defines its destructor only in the header as = default. Why does this fail to compile?

  1. The defaulted destructor needs Impl complete to invoke the deleter on it Correct answer
  2. unique_ptr can never hold an incomplete type in any context in C++
  3. The constructor must see Impl to size the pointer, so the definition is needed
  4. The compiler cannot generate a move constructor for an incomplete member
MCQSEXAM Read explanation

Teacher or blogger? Put this quiz on your website

Free Computer Science MCQs quiz with answers for your school site, academy page or blog. Copy one line of code – works on WordPress and Blogger.

Get the quiz widget