Showing 241–260 of 603

Q241.Compute the factorial function F(n) = n! for an arbitrary nonnegative Integer n. n! = 1 * 2 * ... * (n-1) * n with 0! = 1 by definition. Which recursive algorithm computes F(n)?

Easy
A If n >= 1 return 1 else return F(n - 1) * n
B If n = 0 return 1 else return F(n - 1) * n
C If n = 1 return 1 else return F(n - 2) * n
D None of these
Programming Basics PPSC

Correct Answer: B

The correct recursive factorial base case is 0! = 1, and the recursive step is n * F(n-1) for n > 0. So, "If n = 0 return 1 else return F(n - 1) * n" is correct.

Q242.Which of the following is the Preprocessor Directive in C++?

Easy
A Using namespace std;
B #include <iostream>
C // comments
D None of these
Programming Basics PPSC

Correct Answer: B

In C++, preprocessor directives start with the # symbol (like #include <iostream>).

Q243.What is the overall time complexity of the merge sort algorithm?

Easy
A O(n log n)
B O^2(n log n)
C O(n log n^2)
D None of these
Programming Basics PPSC

Correct Answer: A

Merge Sort has a consistent time complexity of O(n log n) in all cases (best, average, worst).

Q244.What is the space complexity of the HeapSort algorithm?

Easy
A O(1)
B O(2)
C O(3)
D None of these
Programming Basics PPSC

Correct Answer: A

Heap Sort is an in-place sorting algorithm, requiring constant auxiliary space, O(1).

Q245.What is the space complexity of the Quicksort algorithm?

Easy
A O(log n)
B O^2(log n)
C O(log n^2)
D None of these
Programming Basics PPSC

Correct Answer: A

Quick Sort has an average auxiliary space complexity of O(log n) due to the call stack of its recursive partitioning.

Q246.In Tuple Relational Calculus, to express the query "Find the set of all tuples S such that F(S) is true", how can we write this?

Easy
A {S = F(S)}
B {S < F(S)}
C {S | F(S)}
D None of these
Database Basics PPSC

Correct Answer: C

Tuple Relational Calculus uses the set notation {S | F(S)} to represent all tuples S that satisfy the predicate formula F(S).

Q247.Which of the following is the Best Case Time Complexity of the Bubble Sort algorithm?

Easy
A O(n)
B O(n^2)
C O^2(n^2)
D None of these
Programming Basics PPSC

Correct Answer: A

An optimized Bubble Sort (using a flag to detect if any swaps occurred) has a best-case time complexity of O(n) when the input array is already sorted.

Q248.What are the advantages of compiled languages?

Easy
A It is easy to write the source code
B It is faster to declare variables
C Their execution speed is faster
D Both A and B
Programming Basics PPSC

Correct Answer: C

Compiled languages are translated to machine code before execution, making their execution speed significantly faster than interpreted languages.

Q249.Which of the following is the Best Case Time Complexity of the Quicksort algorithm?

Easy
A O(n log n^2)
B O^2(n log n)
C O(n log n)
D None of these
Programming Basics PPSC

Correct Answer: C

Quick Sort achieves its best-case time complexity of O(n log n) when the partitioning is balanced (the pivot splits the array into roughly equal halves).

Q250.Which of the following is an Implementation of dynamic arrays in C++?

Easy
A List
B ArrayList
C Vector
D None of these
Programming Basics PPSC

Correct Answer: C

In C++, the std::vector class implements a dynamic array that can automatically grow and shrink in size.

Q251.What is the space complexity of the merge sort algorithm?

Easy
A O(n)
B O(n log n)
C O(n^2)
D None of these
Programming Basics PPSC

Correct Answer: A

Merge Sort is not an in-place algorithm; it requires auxiliary arrays of size n during the merge phase, resulting in a space complexity of O(n).

Q252.What is a Candidate Key in Database?

Easy
A The minimal set of attributes that uniquely identifies each occurrence of an entity type.
B Set of one or more attributes that can be used to uniquely identify the records in a table.
C The candidate key that is selected to uniquely identify each occurrence.
D None of these
Database Basics PPSC

Correct Answer: A

A Candidate Key is a minimal set of attributes that uniquely identifies each tuple (record) in a relation. One of these candidate keys is chosen as the primary key.

Q253.What is the worst case time complexity of a quick sort algorithm?

Easy
A O(log N)
B O(N log N)
C O(N^2)
D None of these
Programming Basics PPSC

Correct Answer: C

Quick Sort has a worst-case time complexity of O(N^2), occurring when the pivot consistently partitions the array extremely unevenly (e.g., if the array is already sorted or reverse sorted).

Q254.In which of the following facility, all of the work of thread management is done by the application and the kernel is not aware of the existence of threads?

Easy
A Single-Threaded Rendering facility
B Kernel Level Threads facility
C User Level Threads facility
D Multithreading Thread facility
Operating Systems PPSC

Correct Answer: C

In User-Level Threads (ULT), all thread management is done by the application using a threads library. The kernel is unaware of these threads and schedules the process as a single unit.

Q255.Informally, an algorithm can be said to exhibit a growth rate on the order of a function f(n) if beyond a certain input size n, the function f(n) times a positive constant provides an upper bound or limit for the run-time of that algorithm. In other words, for a given input size n greater than some n0 and a constant c, the running time of that algorithm will never be larger than ______?

Easy
A c × f(n)
B c × f(n²)
C c² × f(n)
D None of these
Programming Basics PPSC

Correct Answer: A

c × f(n). This is describing Big O notation, where f(n) is the growth rate of the algorithm's runtime. The definition says: For n greater than some n₀, there exists a constant c > 0 such that runtime ≤ c × f(n), meaning the runtime is bounded above by c × f(n).

Q256.In mail merge, which of the following might represent the main document?

Easy
A A form letter
B A sale brochure
C A database
D A sheet of names and addresses
Database Basics PPSC

Correct Answer: A

In a Mail Merge, the main document holds the static layout and template text (e.g., a form letter) that is combined with a dynamic data source.

Q257.Which of the following operating systems reads and reacts to inputs in actual, predictable time?

Easy
A Real Time System
B Time Sharing System
C Batch Processing System
D None of these
Operating Systems PPSC

Correct Answer: A

A Real-Time Operating System (RTOS) is a specialized OS that reads, processes, and responds to inputs within precise, immediate, and predictable time constraints.

Q258.What does RAID stand for in computer data storage technologies?

Easy
A Reliable Array of Independent Disks
B Remote Access Information Database
C Redundant Array of Inexpensive Disks
D None of these
Database Basics PPSC

Correct Answer: C

RAID stands for Redundant Array of Inexpensive (or Independent) Disks, a technology that combines multiple physical drives for redundancy or speed.

Q259.In MS Access, how many primary keys can typically be defined per table?

Easy
A 1
B 2
C 3
D 4
Database Basics PPSC

Correct Answer: A

Relational databases permit only one Primary Key (which uniquely identifies each row) per table.

Q260.The famous Android operating system was established and further developed by which company?

Easy
A Microsoft
B Google
C Iphone
D None of these
Operating Systems PPSC

Correct Answer: B

Google acquired Android Inc. in 2005 and has since driven its development and global deployment.