0% found this document useful (0 votes)
28 views

Pandian Saraswathi Yadav Engineering College: Arasanoor, Sivagangai Interview Questions

Here is a Python program to find all pairs in an array of integers whose sum is equal to a given number: ```python def find_pairs(arr, n, sum): pairs = [] for i in range(n): for j in range(i+1, n): if arr[i] + arr[j] == sum: pairs.append((arr[i], arr[j])) return pairs arr = [2, 6, 3, 9, 11] n = len(arr) sum = 9 print(find_pairs(arr, n, sum)) ``` This program takes the integer array, its size and the given sum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Pandian Saraswathi Yadav Engineering College: Arasanoor, Sivagangai Interview Questions

Here is a Python program to find all pairs in an array of integers whose sum is equal to a given number: ```python def find_pairs(arr, n, sum): pairs = [] for i in range(n): for j in range(i+1, n): if arr[i] + arr[j] == sum: pairs.append((arr[i], arr[j])) return pairs arr = [2, 6, 3, 9, 11] n = len(arr) sum = 9 print(find_pairs(arr, n, sum)) ``` This program takes the integer array, its size and the given sum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Pandian Saraswathi Yadav Engineering College

Arasanoor, Sivagangai
Interview Questions

1. Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst
case complexity of sorting n numbers using randomized quicksort ?

(A) 0(n) (B) 0(nlogn) (C) 0(n2) (D) 0(n!)

2. What is the minimum number of stacks of size n required to implement a queue to size n ?

(A) One (B) Two (C) Three (D) Four

3. Level order traversal of a rooted tree can be done by stating from the root and Performing

(A) preorder traversal (B) in order traversal (C) depth first search (D) breadth first search

4. The tightest lower bound on the number of comparisons, in the worst case, for comparison -based sorting is
of the order of

(A) n (B) n2 (C) nlogn (D) nlog2n

5. Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which
of these pairs identify a tree uniquely?

1. preorder and postorder


2. inorderr and postorder
3. preorder and inorder
4. level order and postorder

(A) 1 only (B) 2 and 3 (C) 3 only (D) 4 only.

6. Which of the following assertions is false about the internet Protocol (IP) ?

(A) It is possible for a computer to have multiple IP addresses


(B) IP packets from the same source to the same destination can take different routes in the network
(C) IP ensures that a packet is farwarded if it is unable to reach its destination within a given number of
hopes
(D) The packet source cannot set the route of an outgoing packets; the route is determined only
by the routing tables in the routers on the way.

7. Which of the following functionalities must be implemented by a transport protocol over and
above the network protocol ?

(A) Recovery from packet losses


(B) Detection of duplicate packets
(C) Packet delivery in the correct order
(D) End to end connectivity

8. Which of the following is NOT true with respective to a transparent bridge and a router ?
(A) Both bridge and router selectively farward data packets
(B) A bridge uses IP addresses while a router uses MAC addresses
(C) A bridge builds up its routing table by inspecting incoming packets
(D) A router can connect between a LAN and a WAN.

9. For which one of the following reason: does Internet Protocol (IP) use the timeto-live (TTL) field
in the IP datagram header?

(A) Ensure packets reach destination within that time


(B) Discard packets that reach later than that time
(C) Prevent packets from looping indefinitely
(D) Limit the time for which a packet gets queued in intermediate routers

10. Which one of the following is not a client-server application ?

(A) Internet chat (B) Web browsing (C) E-mail (D) Ping

11. Where does the swap space reside ?

(A) RAM (B) Disk


(C) ROM (D) On-chip cache

12. Which of the following scheduling algorithms is non-preemptive ?

(A) Round Robin


(B) First-In First-Out
(C) Multilevel Queue Scheduling
(D) Multilevel Queue Scheduling with Feedback

13. Using a larger block size in a fixed block size file system leads to

(A) better disk throughput but poorer disk space utilization


(B) better disk throughput and better disk space utilization
(C) poorer disk throughput but better disk space utilization
(D) poorer disk throughput and poorer disk space utilization

14. The minimum number of page frames that must be allocated to a running process
in a virtual memory environment is determined by

(A) the instruction set architecture (B) page size (C) physical memory size (D) number of processes in
memory

15. Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?

(A) In deadlock prevention, the request for resources is always granted if the resulting state is safe
B) In deadlock avoidance, the request for resources is always granted if the resulting state is safe
(C) Deadlock avoidance is less restrictive than deadlock prevention
(D) Deadlock avoidance requires knowledge of resource requirements a priori
16. Which one of the following is NOT desired in a good Software Requirement Specifications (SRS)
document?

(A) Functional Requirements


(B) Non-Functional Requirements
(C) Goals of Implementation
(D) Algorithms for Software Implementation

17. Which of the following scenarios may lead to an irrecoverable error in a database system?

(A) A transaction writes a data item after it is read by an uncommitted transaction


(B) A transaction read a data item after it is read by an uncommitted transaction
(C) A transaction read a data item after it is written by an committed transaction
(D) A transaction read a data item after it is written by an uncommitted Transaction

18. Consider the following functional dependencise in a database:

Data_of_Birth"Age
Age"Eligibility
Name"Roll_number
Roll_number"Name
Course_number"Course_name
Course_number"Instructor
(Roll_number,Course_number)"Grade
The relation(Roll)number,Name,Date_of_brith,Age) is

(A) in second normal normal form but not in third normal form
(B) in third normal form but not in BCNF
(C) in BCNF
(D) in none of the above

19. Which one of the following statements is FALSE?

(A) Any relation with two attributes is in BCNF


(B) A relation in which every key has only one attribute is in 2NF
(C) A prime attribute can be transitively dependent on a key in 3NF relation
(D) A prime attribute can be transitively dependent on a key in a BNCF relation.

20. A clustering index is defined on the fields which are of type

(A) Non-key and ordering (B) Non-key and non-ordering (C) key and ordering (D) Key and non-ordering
Write a program to Find all Pairs in Array of Integers Whose sum is Equal to a Given Number at Runtime

Example :

Input: integer array is {2, 6, 3, 9, 11} and given sum is 9,


Output should be {6,3}

You might also like