Home
MCQs by exam
PPSC IT
PPSC IT MCQs · Page 11
577 multiple choice questions typical of the PPSC IT exam, with answers and explanations. Switch on practice mode to test yourself first.
A
Strong consistency only in the us-east-1 region, with eventual consistency in every other region
B
Strong read-after-write consistency for PUTs of new objects and overwrites, and for list operations
Correct answer
C
Eventual consistency for all operations, with no listing guarantee and no overwrite guarantee
D
Eventual consistency for overwrites only, with strong consistency everywhere else in the whole service
A
Both require application changes, since neither approach affects the instance count or the load balancer configuration at all
B
Vertical scaling enlarges one instance and often needs a restart, while horizontal scaling adds instances and requires statelessness or load balancing
Correct answer
C
Vertical scaling adds more instances to the tier, while horizontal scaling enlarges the instance type, so the two terms are very often swapped in practice
D
Horizontal scaling is limited by the largest instance size that the provider offers, so it cannot grow beyond a single machine without sharding
A
About 4.3 minutes
B
About 72 minutes
C
About 43 minutes
Correct answer
D
About 7 minutes
A
An availability zone is one or more discrete data centres with independent power and cooling inside a region, while a region is a geographic area containing several zones
Correct answer
B
An availability zone spans multiple countries and contains many regions, while a region is a single data centre with redundant power, cooling and networking of its own
C
A region is one data centre with all of its racks, and an availability zone is a subset of those racks inside it, so the two terms describe the same facility at different scales
D
An availability zone is a billing boundary that groups accounts, while a region is a network boundary that groups several of those billing boundaries together
A
Neither, because patching is automated by the hypervisor at every boot of the guest
B
The provider, because it owns the physical hosts and the hypervisor that sits beneath them
C
The customer, because in IaaS the provider stops at the hypervisor and virtual hardware
Correct answer
D
Both equally, under a default that splits patching by kernel version and by machine image
A
The call is ambiguous and fails to compile, because the two declarations disagree about the default argument values used
B
20, because the dynamic type of the object is Derived and its own default arguments apply to the call in full
C
10, because default arguments are bound statically from the pointer's type while the override is chosen dynamically
Correct answer
D
10 or 20 depending on the compiler, since the standard leaves the choice of default arguments unspecified here
A
A compile error is guaranteed on every conforming compiler, because const_cast is rejected there
B
Undefined behaviour, because modifying an object that is genuinely const is not allowed
Correct answer
C
It works and c becomes the new value, because the pointer overrides the const qualifier
D
It is well defined, but the write is silently discarded, so c keeps its original value of 10
A
Their destructors run in reverse order of construction as the stack unwinds
Correct answer
B
They are leaked, because destructors only run at normal return
C
They are destroyed only if their class has a virtual destructor
D
std::terminate is called before any destructor runs
A
operator++ and operator--, in prefix or postfix form, cannot be overloaded
B
The conditional operator ?: together with ::, . (member access), .* and sizeof
Correct answer
C
operator[] and operator(), although both are member functions with arguments and return values
D
operator new and operator delete, in either their throwing or their non-throwing forms
A
map keeps keys ordered with O(log n) operations; unordered_map gives average O(1) with no ordering and O(n) worst case
Correct answer
B
Both keep the keys ordered, differing only in hash quality, so iteration order is identical for both of the two containers
C
unordered_map iterates in insertion order, unlike map, which re-sorts the keys at every single insertion
D
map gives O(1) lookup while unordered_map is O(log n), because a balanced tree always beats a hash table
A
A second declaration inside main, because the initialiser was not visible outside the class scope
B
An out-of-class definition, because the in-class initialiser served only as a declaration for such uses
Correct answer
C
A definition in every translation unit that included the header, to satisfy the one-definition rule
D
Nothing, since in-class initialisers always provided a full definition that the linker was normally able to use
A
It returns memory aligned to at least 4096 bytes, which malloc is not required to guarantee for any type
B
It zero-initialises the object unless a constructor sets fields, which malloc never does for any type
C
It can allocate arrays, whereas malloc cannot, because malloc knows nothing about element counts
D
It runs T's constructor and reports failure by throwing std::bad_alloc instead of returning null
Correct answer
A
It is copyable, and copying it duplicates the object with a fresh allocation
B
It is move-only: copying is deleted, and ownership is transferred with std::move
Correct answer
C
It may be copied, but both pointers then share ownership through a hidden reference count
D
It requires a reference count stored in a control block allocated beside the managed object
A
The program fails to compile, because virtual calls in constructors are illegal and are always rejected by every conforming compiler
B
Derived's version, because the dynamic type of the object is already Derived from the moment the allocation completes
C
Base's version, because during base construction the vptr still refers to Base's vtable and the Derived part does not yet exist
Correct answer
D
It is undefined behaviour, so either version may run depending on the compiler and on the optimisation level used
A
It turns a would-be silent non-override, such as a missing const or a wrong parameter type, into a compile error
Correct answer
B
It allows the function to be inlined by the compiler, because the exact target is known at compile time
C
It forces the base function to become virtual for the first time, even when the base declares it non-virtual
D
It makes the function callable through a base pointer, which is otherwise impossible for a derived member function
A
Declaring at least one pure virtual function, such as virtual void f() = 0;
Correct answer
B
Declaring the constructor protected, so only derived classes can create objects
C
Making every member function virtual, so the class cannot be instantiated on its own
D
Declaring all data members private, so no outside code can construct it
A
nullptr for both pointer and reference casts
B
A pointer to the nearest base sub-object instead
C
It causes undefined behaviour because the cast cannot be checked
D
nullptr for a pointer cast, while the reference form throws std::bad_cast
Correct answer
A
A new element with a value-initialised int of 0 is inserted, so a lookup silently grows the map
Correct answer
B
std::out_of_range is thrown, exactly as counts.at('alpha') would throw for a missing key
C
A reference to a shared static zero is returned and the map itself is left unmodified
D
An iterator to the end of the map is returned, and dereferencing it is undefined behaviour
A
Base::print, because object slicing copies only the Base sub-object into the parameter
Correct answer
B
It is undefined behaviour, so either version may run depending on the optimisation level
C
Derived::print, because the argument's dynamic type stays Derived inside the function
D
Derived::print if Base's destructor is virtual, else Base::print, since dispatch depends on it
A
Nothing; all special members are still generated normally
B
The move constructor and move assignment operator
Correct answer
C
The default constructor and the copy constructor
D
Only the destructor, which must then be defined by the user
A
Copy-initialisation uses the copy constructor; assignment to an existing object uses the copy assignment operator
Correct answer
B
Both use the copy constructor, since the equals sign always means construction even for a live object
C
Both use the copy assignment operator, since the equals sign always means assignment whatever the surrounding context
D
T b = a; uses the default constructor followed by assignment, because b is an already constructed object
A
Both set only capacity, differing solely in the exception guarantees offered when a reallocation fails
B
reserve sets capacity to 100 with size still 0; resize sets size and capacity to 100 with value-initialised elements
Correct answer
C
Both set size to 100, but reserve leaves the new elements uninitialised until each element is written
D
reserve sets size to 100 and resize only sets capacity, so writing v[0] directly after reserve is perfectly well defined
A
m2, m1, B, A for initialisation, matching the initialiser list
B
m1, m2, A, B for initialisation and A, B, m1, m2 for destruction
C
A, B, m1, m2 for initialisation and the same order for destruction
D
A, B, m1, m2 for initialisation and m2, m1, B, A for destruction
Correct answer
A
0, because the class has no members
B
4, because every object needs a vtable pointer
C
8 on 64-bit platforms, matching the pointer size
D
1, because distinct objects must have distinct addresses
Correct answer
A
Only D's destructor runs, because the dynamic type is D
B
Undefined behaviour: only B's destructor runs, because B's destructor is not virtual
Correct answer
C
Both destructors run, since destructors are always virtual
D
A compile error, because a base pointer cannot delete a derived object
Practise on paper
Preparing for PPSC IT?
Make it your exam plan: see your progress in every subject and topic, set a daily goal and practise what you have not done yet.
Start my PPSC IT plan
Test yourself
Take a timed online test and get a certificate, or play today's quick quiz.
Online tests
Daily quiz