0% found this document useful (0 votes)
35 views

TI Tech Test

This document contains 20 multiple choice questions about C programming concepts such as: 1) How the C compiler interprets statements with operators like addition and assignment. 2) Advantages of using subroutines such as modularity. 3) What a function returns when given an integer parameter and performing Celsius to Fahrenheit conversion. 4) Time complexity of searching a 1D array divided into partitions with each partition searched using binary search. 5) Correct way to access elements of an array using pointers. 6) The terminator in C language. The questions cover a wide range of C programming topics including functions, arrays, pointers, loops, data types and more.

Uploaded by

Shreeji Exports
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

TI Tech Test

This document contains 20 multiple choice questions about C programming concepts such as: 1) How the C compiler interprets statements with operators like addition and assignment. 2) Advantages of using subroutines such as modularity. 3) What a function returns when given an integer parameter and performing Celsius to Fahrenheit conversion. 4) Time complexity of searching a 1D array divided into partitions with each partition searched using binary search. 5) Correct way to access elements of an array using pointers. 6) The terminator in C language. The questions cover a wide range of C programming topics including functions, arrays, pointers, loops, data types and more.

Uploaded by

Shreeji Exports
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Texas Instruments Technical Test Paper Questions

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

Q2. Which is not an advantage of using subroutines?

a) Easier maintenance
b) Runtime reduces
c) Storage space reduces
d) Modularity

Q3. Read the function conv() given below

conv(int t){ int u; u=5/9 * (t-32); return(u); }

What is returned?

a) 15
b) 0
c) 16.1
d) 29

Q4. What does the following function print?

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) (x & (1 << i))


b) ! (x & (1 << i))
c) ! (x && (1 << i))
d) None of these

Q7. Given a matrix A. What is the minimum number of multiplications do you


need to compute A10?

a) 9
b) 5
c) 4
d) 6

Q8. Given the piece of code

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}

Q9. The C language terminator is

a) semicolon
b) colon
c) period
d) exclamation mark

Q10. Which of the following is a semantic error?

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

Q11. What is false about the following -- A compound statement is

a) A set of simple statements


b) Demarcated on either side by curly brackets
c) Can be used in place of simple statement
d) A C function is not a compound statement.

Q12. Write one statement equivalent to the following two statements:

x=sqr(a);
return(x);

Choose from one of the alternatives

a) return(sqr(a));
b) printf(sqr(a));
c) return(a*a*a);
d) printf(%d,sqr(a));

Q13. A k-diagonal matrix is a n *n square matrix in which the elements on the


principal diagonal and k diagonals above the principal diagonal and k diagonals
below the principal diagonal only have none zero elements. Other elements are
zeros. In order to save the space, the non zero elements are stored in a one
dimensional array. The number of locations in this array are:

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;

Q15. What is true about the following C functions?


a) Need not return any value
b) Should always return an integer
c) Should always return a float
d) Should always return more than one value

Q16. A memory of 20 bytes is allocated to a string declared as char *s


then the following two statements are executed:

s=Entrance
l=strlen(s);

What is the value of l ?

a) 20
b) 8
c) 9
d) 21

Q17. Main must be written as

a) The first function in the program


b) Second function in the program
c) Last function in the program
d) Anywhere in the program

Q18. Which of the following is not an infinite loop?

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?

a) Comments can go over multiple lines


b) Comments can start anywhere in the line
c) A line can contain comments without any language statements
d) Comments can occur within comments

Q20. Which of the following about automatic variables within a function is


correct?

a) Its type must be declared before using the variable


b) They are local
c) They are not initialized to zero
d) They are global

You might also like