TI Tech Test
TI Tech Test
Q1. How does the C compiler interpret the following two statements?
p=p+x;
q=q+y;
a) p=p+x; q=q+y
b) p=p+xq=q+y
c) p=p+xq; q=q+y
d) p=p+x/q=q+y
a) Easier maintenance
b) Runtime reduces
c) Storage space reduces
d) Modularity
What is returned?
a) 15
b) 0
c) 16.1
d) 29
func(int i)
{ if(i%2)return 0;
else return 1;}
main()
{ int =3; i=func(i); i=func(i); printf(%d,i); }
a) 3
b) 1
c) 0
d) 2
Q5. A 1D - array A whose size is N is given and is divided into P partitions and an
element x is to be searched in the array. Each partition is given to one processor.
The elements are searched within the partition using a binary search. What is the
time complexity of the algorithm?
a) O (N/P)
b) O (P)
c) O ( log (N/P))
d) O ( log (N/P)) + O (P log P)
Q6. If the following code segment is to count the number of zeros in the given
integer x in its binary representation, what is to be replaced by CONDITION?
int i, count, x;
for(i=0, count=0;i<16;i++)
if(CONDITION)
count++;
a) 9
b) 5
c) 4
d) 6
int a[50];
int *pa;
pa=a;
To access the 6th element of the array which of the following is incorrect?
a) *(a+5)
b) a[5]
c) pa[5]
d) *(*pa + 5}
a) semicolon
b) colon
c) period
d) exclamation mark
a) Division by zero
b) Missing of a semicolon at the end of a statement
c) Assigning a single precision real value to a long integer
d) All the above
x=sqr(a);
return(x);
a) return(sqr(a));
b) printf(sqr(a));
c) return(a*a*a);
d) printf(%d,sqr(a));
a) n*(n-k-1)/2
b) n*(n-1)/ (n-k)(n-k-2)
c) n*(n-1) / (n-k)(n-k-2)
d) n*n / (n-k-1)
Q14. Write the code segment to insert an element p into the linked list after an
element q? Make necessary pointer adjustments?
ANS:
p.next = q.next;
q.next = p;
s=Entrance
l=strlen(s);
a) 20
b) 8
c) 9
d) 21
a) while(1){ ....}
b) for(;;)
c) x=0;
do{ /*x unaltered within the loop*/ }
while(x = = 0);
d) # define TRUE 0 while(TRUE){ ...}
Q19. Which of the following about the C comments is incorrect?