Ti Pap

download Ti Pap

of 5

Transcript of Ti Pap

  • 8/14/2019 Ti Pap

    1/5

    C - Language------------

    1. int SizeOfArray(arr)int arr[];{

    return (sizeof(arr)/sizeof(int));}void main(){

    int ArrOfInt[24];int *PtrToArray;PtrToArray=(int *)malloc(sizeof(int)*24);printf("%d %d ",(sizeof(ArrOfInt)/sizeof(int)),SizeOfArray(ArrOfInt));printf("%d %d ",(sizeof(PtrToArray)/sizeof(int)),SizeOfArray(PtrToArray));free(PtrToArray);

    }

    Assuming the size of integer and the size of an integer pointer to be equal,what is the output of the above program?

    a) 24 24 24 24 b) 24 24 24 1 c) 24 24 1 1 d) 24 1 1 1 2. The register qualifier can be applied only to those variables that are

    a) static and auto b) auto and extern c) static only d) auto only

    3. i) #define UINT unsigned int; ii) #define CHARP char *;typedef unsigned int UINT; typedef char * CHARP;

    a) In ii only, both the statements have the same effect.b) In i and ii, both the statements do not have the same effectc) In i only, both the statements have the same effectd) In i and ii, both the statements have the same effect

    4. void main(){

    printf("%s%c%c%c%c",&7["TREADING"],1["TREADING"],2["TREADING"],3["TREADING"],"TREADING"[0]);

    }

    a) INDIA b) TREADING c) GREAT d) Compilation error

    5. C is not a block structured language. This is a reason as to why

    a) C functions cannot be directly implemented as call by referenceb) A program cannot have multiple mainsc) Nested function definitions are not possible

    d) All the variables have to be declared at the beginning of the program 6. printf is a macro defined using

    a) putchar()b) putc()c) fputc()d) fprintf()

    7. When a program is started, the files that are opened automatically are

  • 8/14/2019 Ti Pap

    2/5

    a) stdinb) stderrc) stdin, stdout and stderrd) None

    8. As far as the operators + and , are concerned, which one is true?

    a) , is not an operator, + always is an operatorb) + can act as a separator, , is always an operatorc) , can act as a separator as well an operatord) + can act as a separator as well an operator

    9. In scanf, input assignment to a variable can be suppressed by using

    a) %?b) %!c) %$d) %*

    10. The keyword continue cannot come in a

    a) while blockb) do while blockc) switch blockd) for block

    OS--

    1. A print job is given to a laserjet at the same time in the following order :3 pages of A, 5 pages of B, 11 pages of C and 7 pages of D. If the printerprints A first, followed by B, D and C in that order, what schedulingalgorithm has it followed?

    a) Round robin b) First In First Out c) Shortest Job First d) Preemptive

    2. For a deadlock to occur, which of the following conditions need not be true?

    a) Each resource is mutually exclusive to only one processb) Processes holding resources can request for new resourcesc) All the processes have to be in a queue waiting for each resourced) Resources that are allocated to a process can be freed only by that

    process

    3. In memory swapping, the technique of combining all segments of free memoryinto a single unit is called

    a) External fragmentationb) Compactionc) Compressiond) Internal fragmentation

    4. The average score of the candidates in the TI test is 8 out of 15 questions.When the number of questions was increased to 20, the average score was 7.What would you call this?

    a) Dining Philosopher's problemb) Sleeping barber's problem

  • 8/14/2019 Ti Pap

    3/5

    c) Banker's algorithmd) Belady's anomaly

    5. When files and directories can be shared by different users, the file systemresembles a

    a) Directed cyclic graphb) Directed acyclic graphc) n-ary Treed) Linked list

    Data Structures---------------

    1. If a set of character strings (of length k) are stored in a binary tree,then the time to search the tree for a string (of length k) is of the order

    a) O(log k)b) O(log n)c) O(n.log k)d) O(k.log n)

    2. If an array is sorted in the following sequence, what is the algorithm used?

    9 8 7 6 5 3 1 18 9 6 7 3 5 1 16 7 8 9 1 1 3 51 1 3 5 6 7 8 9

    a) Heap sortb) Bubble sortc) Quick sortd) Merge sort

    3. Assume that START is any node in a circularly linked list (singly linked).Consider the following algorithm to delete a node PTR in the list.

    procedure delete(node PTR, node START){

    node TMP=START, DELNODE;label:if (TMP->NEXT == PTR) {

    DELNODE = TMP->NEXT;TMP->NEXT= TMP->NEXT->NEXT;goto OUTOFLOOP;

    }

    else {TMP=TMP->NEXT;if (TMP==START) goto EXITPGM;goto label;

    }OUTOFLOOP:delete DELNODE;EXITPGM:print "out of program";

    }

  • 8/14/2019 Ti Pap

    4/5

    a) It will go into an infinite loopb) It works perfectlyc) It wont work only if START==PTRd) It wont work for many cases

    4. Consider the following algorithm and determine the complexity

    for (i=1; i

  • 8/14/2019 Ti Pap

    5/5

    9. Consider the following recursive equation. What does it generate?

    f(n) = f(f(n-1)) + f(n-f(n-1)) with f(1)=1 and f(2)=1

    a) 1,1,1,1,1,1...b) 1,1,2,3,5,8...c) 1,1,2,2,3,3...d) 1,1,11,11,1111,1111...

    10. The maximum length of the shortest path between two vertices in a complete

    undirected graph of n vertices is

    a) nb) log nc) n - 1d) 1

    --------------17F1CCB8B3A58C2284B6FF8AContent-Type: text/x-vcard; charset=us-ascii;

    name="raghu.vcf"Content-Transfer-Encoding: 7bitContent-Description: Card for Raghuraman RContent-Disposition: attachment;

    filename="raghu.vcf"

    begin:vcardn:R;Raghuramantel;work:(080) 5099 113x-mozilla-html:FALSEorg:ASIC;Texas Instrumentsversion:2.1email;internet:[email protected]:Software Design Engineeradr;quoted-printable:;;Golf view Homes,=0D=0AWind TunnelRoad,=0D=0AMurgeshpalya;Bangalore;Karnataka;560017;Indiax-mozilla-cpt:;3992fn:Raghuraman Rend:vcard

    --------------17F1CCB8B3A58C2284B6FF8A--