You are on page 1of 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 effect
c) In i only, both the statements have the same effect
d) 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 reference


b) A program cannot have multiple mains
c) 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
a) stdin
b) stderr
c) stdin, stdout and stderr
d) None

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

a) , is not an operator, + always is an operator


b) + can act as a separator, , is always an operator
c) , can act as a separator as well an operator
d) + 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 block
b) do while block
c) switch block
d) 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 printer
prints A first, followed by B, D and C in that order, what scheduling
algorithm 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 process


b) Processes holding resources can request for new resources
c) All the processes have to be in a queue waiting for each resource
d) 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 memory


into a single unit is called

a) External fragmentation
b) Compaction
c) Compression
d) 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 problem


b) Sleeping barber's problem
c) Banker's algorithm
d) Belady's anomaly

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

a) Directed cyclic graph


b) Directed acyclic graph
c) n-ary Tree
d) 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 1
8 9 6 7 3 5 1 1
6 7 8 9 1 1 3 5
1 1 3 5 6 7 8 9

a) Heap sort
b) Bubble sort
c) Quick sort
d) 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";
}
a) It will go into an infinite loop
b) It works perfectly
c) It wont work only if START==PTR
d) It wont work for many cases

4. Consider the following algorithm and determine the complexity

for (i=1; i<=n; i++)


{
<some unit time operations>

for (j=1;j<=n; j= j*2)


{
<some unit time operations>

for (k=0;k<100;k++)
{
<some unit time operations>
}
}
}

Note: (a^x) refers to a to the power of x.

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

5. In a binary tree, which traversal would reach the leaf nodes last?

a) Inorder traversal
b) Depth first traversal
c) Breadth first traversal
d) Preorder traversal

6. The data structure that is most suitable for implementing dictionaries

a) Linked list
b) Stack
c) Binary tree
d) Hash table

7. A k coloring of a undirected graph is a function such that no two adjacent


vertices have the same colour. Now, which of the following is true?

a) Only a binary tree is 2-colourable.


b) Only a binary tree is 3-colourable and not 2-colourable.
c) Any tree is 2-colourable
d) Any tree is 3-colourable and not 2-colourable.

8. The number of paths from the root to all the leaf nodes in a directed
complete binary tree of height n is

a) 2n
b) 2^n
c) (2^n)^n
d) (2n)^n
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) n
b) log n
c) n - 1
d) 1

--------------17F1CCB8B3A58C2284B6FF8A
Content-Type: text/x-vcard; charset=us-ascii;
name="raghu.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Raghuraman R
Content-Disposition: attachment;
filename="raghu.vcf"

begin:vcard
n:R;Raghuraman
tel;work:(080) 5099 113
x-mozilla-html:FALSE
org:ASIC;Texas Instruments
version:2.1
email;internet:raghu@ti.com
title:Software Design Engineer
adr;quoted-printable:;;Golf view Homes,=0D=0AWind Tunnel
Road,=0D=0AMurgeshpalya;Bangalore;Karnataka;560017;India
x-mozilla-cpt:;3992
fn:Raghuraman R
end:vcard

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

You might also like