test

13
Technical 1. Declare a function pointer and call it for the function void fun { printf(“MCA2k11”); } 2. What would be output? main() { char str[] = “JNUMCA2k11”; int a; printf(a>10 ? “%5s” : “%s”, str); } 3. What would be output? int main() { float a = 0.25; if(a < .25) { printf("greater than"); } else if(a == .25) { printf("equal"); } else { printf("less than"); } }

Upload: prateek-sinha

Post on 02-Jan-2016

157 views

Category:

Documents


1 download

DESCRIPTION

test paper

TRANSCRIPT

Page 1: Test

Technical

1. Declare a function pointer and call it for the function void fun { printf(“MCA2k11”); }

2. What would be output?main(){ char str[] = “JNUMCA2k11”;

int a;printf(a>10 ? “%5s” : “%s”, str);

}

3. What would be output?

int main()

{ float a = 0.25; if(a < .25) { printf("greater than"); } else if(a == .25) {

printf("equal");

} else { printf("less than"); } }

4. Write a macro print(x, y, z) to print the following.x=4 y=5 z=6main(){

int x = 4, y = 5, z = 6;print(x,y,z);

Page 2: Test

}5. Explain:

int a = 5; const int *p = &a; int * const p = &a; const int * const p = &a; int const *p = &a;

6. What will be outputmain(){

char *ptr;*ptr = (char *)malloc(30);strcpy(ptr, “JNUMCA”);strcat(ptr, “2k11”); printf(“%s”, ptr);free(ptr);

}7. Explain f:

void (* f)(int, void (*)());8. What will be output

#include<iostream>using namespace std;#define PI 3.14int squareArea(int &a){ return a*=a;}double circleArea(int &r){ return PI*r*r;}int main(){ int a = 10; cout<<squareArea(a)<<endl; cout<<circleArea(a)<<endl; return getchar();

Page 3: Test

}9. Output:

#include<iostream>using namespace std;class Alpha{

int data;public:

Alpha(int num){

data=num;}Alpha(Alpha &a){

data=a.data;cout<<"copy constructor\n";

}void display(){

cout<<"value of data is "<<data<<endl;}void operator=(Alpha &a){

data=a.data;cout<<"assignment operator"<<endl;

}};int main(){

Alpha a1(37);Alpha a2(2);a2.display();a2=a1;a2.display();Alpha a3(a1);a3.display();

}

Page 4: Test

10. Write a template function to swap int, char, double values.#include<iostream>using namespace std;//template function definitionmain(){

int a = 5, b = 7;double d = 4.5, e = 5.6;char x = 'x', y = 'y';swapargs(a,b);swapargs(d,e);swapargs(x,y);

}

11. Pankaj stores n data elements in a hash table. He is able to get the best efficiency achievable by a hash table. What is the time complexity of accessing any element from this hash table?

Option 1 : O(1) Option 2 : O(n2) Option 3 : O(log n) Option 4 : O(n)

12. How many comparisons are needed to sort an array of length 5 if a straight selection sort is used and array is already in the opposite order?

Option 1 : 1 Option 2 : 10 Option 3 : 50 Option 4 : 20

13. The best sorting methods if number of swapping done is the only measure of efficiency is

Option 1 : Bubble Option 2 : Selection Option 3 : Insertion Option 4 : Quick

14. A hash table can store a maximum of 10 records. Currently there are records in locations 1, 3, 4, 7, 8, 9, 10. The probability of a new record going into location 2, with a hash function resolving collisions by linear probing is

Option 1 : 0.6 Option 2 : 0.1 Option 3 : 0.2 Option 4 : 0.5

15. Jaswinder has a book of tickets and wants to store ticket numbers in a data structure. New tickets are added to the end of the booklet. Ticket at the top of the stack is issued to the customer. Which data structure should Jaswinder use to represent the ticket booklet?

Option 1 : Queue Option 2 : Stack Option 3 : Array Option 4 : Graph

Page 5: Test

16. Solve the recurrence T(n) = T(n-2) + n2.17. There is an array of size n initialized with 0. Akanksha has to write a code which

inserts the value 3k at position 3k in the array, where k=0,1…(till possible). Akanksha writes an efficient code to do so. What is the time complexity of her code?

18. What is a shell?A: It is a hardware component.B: It is a command interpreter.C: It is a part in computer.D: It is an application program.

19. Divide logical memory into blocks with the same size as frames are called:20. The chunks of memory is known as

A: SectorB:OffsetC:PageD: Frame

21. is the structure of the database.

a.       Table b.      Relation c.       Schema d.      None of these

22. Meta data is A: Small amount of dataB: Large amount of dataC: Redundant dataD: None of these

23. A functional dependency is a relationship between or among:A: tablesB: RowsC: RelationsD: Attributes

24. Which of the following describe router functions?

Page 6: Test

A: Packet SwitchingB: Packet filteringC: Internetwork communicationD: Path selectionE: All of the above

25. The ________ protocol is the transmission mechanism used by the TCP/IP suite. A)       ARP B)       IP C)       RARP D)      none of the above

Aptitude:

1. Rs.460 was divided among 41 boys and girls such that each boy Rs.12 and each girl got Rs.8. What is the number of boys?

A. 33

B. 30

C. 36

D. 28

2. How many litres of water must be added to 16 liters of milk and water contains 10% water to make it 20% water in it

A. 4 litre

B. 2 litre

C. 1 litre

Page 7: Test

D. 3 litre

3. Series: 2,7,24,77,...

4. A candidate appearing for an examination has to secure 40% marks to pass paper i. But he secured only 40 marks and failed by 20 marks. What is the maximum mark for paper i?

5. A man in a train notices that he can count 21 telephone posts in one minute. If they are known to be 50 metres apart, then at what speed is the train travelling? A. 55 km/hr B. 57 km/hr C. 60 km/hr D. 63 km/hr

6. A can finish a work in 18 days and B can do the same in half the time taken by A. Then, working together , what part of the same work they can finish in a day? A. 1/6 B. 1/9 C. 2/5 D. 2/7

7. The true discount on Rs.2562 due 4 months hence is Rs.122. The rate percent is A. 12 % B. 13 % C. 15 % D. 14 %

8. Three unbiased coins are tossed.What is the probability of getting at least 2 heads? A. 1/2 B. 1/4 C. 1/3 D. 1/8

9. In a certain code:'il be pee' means 'roses are blue''sik hee' means 'red flowers''pee mit hee' means 'flowers are vegitables'

so red is written as:

10. arun said "this girl is the wife of the grandson of my mother".

Page 8: Test

who is arun to the girl.

11.a walks 10 m in front and 10 m to the right. then everytime turning his left, he walks 5,15,15 meters respectively.how far is he noe from starting point?

12.choose the odd one out:BDW,DFU,FHS,GIQ,IKP

13. statements:some toms are jerrys, some jerrys are pumbas, no pumba is timon.

conclusions:some toms are timons.no timon is jerry.some pumbas are timons.all toms are pumbas. (more than 1 answers are possible).

14. if A interchanges its position with B, C with D,...... Y with Z. then which letter ll come at 7th position from the left?

15. R * T J L 2 $ D = M # 8 C % B < K 1 & A W ? P E + Q @ 7 F 6how many such numbers are there in the above sequence, each of which is

immidiately preceed by a constant and immidiately followed by a symbol.

16. if 100 cats kills 100 mice in 50 days then 4 cats will kill how many mice in 10 days?

study the following information carefully and answer ques from 17 to 20: there is group of 5 persons A,B,C,D,E.one of them is hotriculturist,one is

physicst,one is journalist,one is industrialist,one is advocate.three of them A,C and advocate prefer tea to coffee and two of them B and

the journalist prefer coffee to tea.the industrialist and D and A are friends to one another but two of them prefer coffee to tea.Hotriculturist is C's brother.

17. who is the hotricuturist? 18. who is industrialist? 19. which of the following includes a person who likes tea bur is not an advocate? 20. who is a physicist?

21.

synonym: ABUNDANT

Page 9: Test

A. Ripe B. CheapC. Plenty D. Absent

22 Antonym:

AUTONOMYA. Slavery B. SubordinationC. Dependence D. Submissiveness

23. choose the correct order:

1. at 2. it 3. take4. once 5. away A. 23514 B. 14352C. 32514 D. 53214E. 42315

24. Given that the passage starts with sentence s1 and ends with s6.find the proper orderinng of sentence.

S1: Calcutta unlike other cities kepts its trams.P : As a result there horrendous congestion.Q : It was going to be the first in South Asia.R : They run down the centre of the roadS : To ease in the city decided to build an underground railway line.S6: The foundation stone was laid in 1972.The Proper sequence should be:A. PRSQ B. PSQRC. SQRP D. RPSQ

25.Pick out the best one which completes the sentence given below:

He tames animals because he ......A. is fond of them B. hates themC. is afraid of them D. want to set them freeE. seldom loves them

26. choose the proper sequencing:

He was so kind and generous thatP : he not onlyQ : made others do soR : but also

Page 10: Test

S : helped them himself

The Proper sequence should be:A. PSRQ B. SPQRC. PRSQ D. QPRS

27.

You haven't had your lunch yet, ...... you?A. are B. aren'tC. have D. haven't

28. choose the part of the sentence having an error in it:

A. He loved B. none butC. his neighbour's daughter. D. No error.

29.

We wentP : along the railway lineQ : and had a right toR : where other people not allowed to goS : but daddy belonged to the railwayThe Proper sequence should be:A. RPQS B. PRSQC. RSQP D. PRQS

30. how many questions have you solved correctly of this paper?