Array and Array Operations Multiple Questions and Answers.

16.Which of the following abstract data types can be used to represent a many to many relation?
A. Tree
B. Plex
C. Graph
D. Both (b) and (c)

17. An algorithm is made up of 2 modules M1&M2. If order of M1 is f(n) & M2 is g(n) then the order of algorithm is?
A. max (f(n),g(n))
B. min (f(n),g(n))
C. f(n) + g(n)
D. f(n) X g(n)

18.An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs to be determined. Which of the following is TRUE about the number of comparisons
A. At least 2n-c comparisons, for some constant c, are needed.
B. At most 1.5n-2 comparisons are needed.
C. At least nlog2n comparisons are needed.
D. None of the above.

19.The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is:
A. Θ(n)
B. Θ(logn)
C. Θ(log*n)
D. Θ(1)

20.Which of the following is an illegal array definition?
A. Type COLONGE : (LIME, PINE, MUSK, MENTHOL); var a : array [COLONGE] of REAL;
B. var a : array [REAL] of REAL;
C. var a : array [‘A’…’Z’] of REAL;
D. var a : array [BOOLEAN] of REAL;


Quick Links

GAT Subject

   Computer Science    English    Agriculture    Botany    


   Computer Science    Civil Engineering    


   Networking    Electronics    Database    

Past Papers

   Model Papers    FPSC    PPSC    NTS