Showing 2341–2360 of 4795

Q2341.Which is the correct syntax to declare an array in JavaScript?

Easy
A var arr = (1 2 3);
B var arr = [1 2 3];
C var arr = {1 2 3};
D var arr = <1 2 3>;
Computer Terminology PPSC

Correct Answer: B

In JavaScript, arrays are declared using square brackets [ ]. Each element inside the brackets is separated by a comma (or spaces in simplified options). Parentheses ( ), curly braces { }, and angle brackets < > are not used for arrays.

Q2342.For storing large volumes of unstructured data like logs or JSON, which NoSQL database is most suitable?

Easy
A MySQL
B MongoDB
C Oracle
D SQL Server
Computer Terminology PPSC

Correct Answer: B

MongoDB is a NoSQL document database that stores data in JSON-like documents. It is ideal for large volumes of unstructured or semi-structured data like logs. Unlike SQL databases (MySQL, Oracle, SQL Server), it does not require a fixed schema.

Q2343.If you want to migrate a PHP website to a modern PHP framework, which one is most commonly used?

Easy
A Laravel
B React
C Django
D Node.js
Internet & Web PPSC

Correct Answer: A

Laravel is a modern PHP framework for building web applications. It provides MVC architecture, routing, and built-in security features. React and Node.js are JavaScript-based, and Django is Python-based.

Q2344.Which of the following describes unsupervised learning?

Easy
A Learning from labeled data
B Learning patterns from unlabeled data
C Learning by reinforcement
D Learning via rules only
Computer Basics PPSC

Correct Answer: B

Unsupervised learning finds patterns or structures in data without labeled outputs. Common tasks include clustering and dimensionality reduction. Supervised learning uses labeled data, while reinforcement learning is based on rewards and penalties.

Q2345.Which of the following is true about client-side vs server-side rendering?

Easy
A Client-side rendering happens on the server
B Server-side rendering happens in the browser
C Client-side rendering happens in the browser; server-side happens on the server
D Both are identical in performance
Internet & Web PPSC

Correct Answer: C

Client-side rendering (CSR) means the browser builds the page using JavaScript after receiving data. Server-side rendering (SSR) means the server sends a fully rendered HTML page to the browser. SSR improves SEO and initial page load speed.

Q2346.In networking, if a device can send data but never receives a reply, what type of issue is this?

Easy
A Client-side problem
B Server-side problem
C Network congestion or routing issue
D Deadlock
Computer Networks PPSC

Correct Answer: C

If a device can send data but never receives a reply, the problem is likely in the network path. Causes include network congestion, faulty routers, or incorrect routing tables. It is not necessarily a client-side or server-side problem if both are working correctly.

Q2347.What is a deadlock in multithreading?

Easy
A When threads finish too quickly
B When threads block each other permanently while waiting for resources
C When threads execute sequentially
D When threads share data safely
General MCQs PPSC

Correct Answer: B

A deadlock occurs when two or more threads wait indefinitely for resources held by each other. None of the threads can proceed, causing the program to freeze. Proper resource management and lock ordering help prevent deadlocks.

Q2348.Analyze the following C++ program and determine its output: int x = 5; if (x > 3) x += 2; else x -= 2; cout << x;

Easy
A 3
B 5
C 7
D 2
Computer Terminology PPSC

Correct Answer: C

The initial value of x is 5. The if condition x > 3 is true. The statement x += 2 is executed, so x becomes 7. The else block is skipped, resulting in an output of 7.

Q2349.What is a mutex lock primarily used for in programming?

Easy
A To encrypt data
B To prevent multiple threads from accessing shared resources simultaneously
C To speed up execution
D To handle recursion
Computer Basics PPSC

Correct Answer: B

A mutex (mutual exclusion) lock ensures that only one thread can access a shared resource at a time. It prevents race conditions, where multiple threads modify data simultaneously.

Q2350.Which Python library is best for numerical computation in ML?

Easy
A Matplotlib
B NumPy
C Seaborn
D Scikit-learn
Computer Terminology PPSC

Correct Answer: B

NumPy is a Python library for numerical computation and array operations. It provides fast mathematical functions for large datasets. Many machine learning libraries like TensorFlow and Scikit-learn use NumPy arrays internally.

Q2351.In a max-heap, if a node has index i (1-based indexing), what is the index of its parent?

Easy
A i + 1
B i / 2
C 2 * i
D i - 1
General MCQs PPSC

Correct Answer: B

In a max-heap using 1-based indexing, the parent of a node at index i is at index i / 2. The left child of node i is at index 2 * i, and the right child is at index 2 * i + 1.

Q2352.If set A has 4 elements and set B has 4 elements, how many elements are in A x B?

Easy
A 4
B 8
C 12
D 16
General MCQs PPSC

Correct Answer: D

The Cartesian product means pairing every element of set A with every element of set B. Number of elements in A x B = (number of elements in A) * (number of elements in B). So, 4 * 4 = 16.

Q2353.Which statement best describes a transitive relation?

Easy
A If A > B and B > C, then A > C
B If A = B and B is not equal to C, then A = C
C If A is adjacent to B, then B is adjacent to A
D If A is connected to B, then B is disconnected from A
Computer Basics PPSC

Correct Answer: A

A transitive relation means that if a relation holds between A and B, and B and C, it also holds between A and C. Example: "greater than" (>) is transitive: if A > B and B > C, then A > C.

Q2354.What will be the output of the following C++ code? bool b = false; cout << b + 2;

Easy
A 0
B 1
C 2
D 3
Computer Terminology PPSC

Correct Answer: C

In C++, false is evaluated as 0 in arithmetic operations. Therefore, b + 2 becomes 0 + 2 = 2.

Q2355.What is the output of the following C++ code? int a = 1, b = 0; cout << (a || a && b);

Easy
A 0
B 1
C Error
D Undefined
Computer Terminology PPSC

Correct Answer: B

&& has higher precedence than ||. a && b evaluates first, which gives 0 (since b is 0). Then, a || 0 is evaluated, which gives 1 (since a is 1). The final output is 1.

Q2356.What is the time complexity of a loop inside a loop, each running n times?

Easy
A O(n)
B O(log n)
C O(n^2)
D O(n log n)
Computer Terminology PPSC

Correct Answer: C

A loop inside another loop is called a nested loop. If both loops run n times, the inner loop runs n times for each iteration of the outer loop. Total iterations = n * n = n^2, giving a time complexity of O(n^2).

Q2357.In data structures, what does unshift do?

Easy
A Adds an element to the beginning
B Removes the last element
C Removes the first element
D Adds an element to the end
Computer Terminology PPSC

Correct Answer: A

In arrays or lists, unshift adds a new element to the start of the structure. The existing elements are shifted one position to the right to make space.

Q2358.In data structures, what does shift do?

Easy
A Removes the first element
B Adds an element to the end
C Removes the last element
D Adds an element to the beginning
Computer Terminology PPSC

Correct Answer: A

In arrays or lists, shift removes the first element. The remaining elements are shifted one position to the left to fill the gap.

Q2359.In data structures, what does push do?

Easy
A Removes the first element
B Adds an element to the end
C Removes the last element
D Adds an element to the beginning
Computer Terminology PPSC

Correct Answer: B

In stack or list data structures, push is used to add an element to the top of the stack or the end of the structure.

Q2360.In data structures, what does pop do?

Easy
A Adds an element to the beginning
B Removes the last element
C Removes the first element
D Adds an element to the end
Computer Terminology PPSC

Correct Answer: B

In a stack, pop removes the element from the top (the last element added). Stacks follow the LIFO (Last In, First Out) principle.