Texas Instruments Technical Paper

Posted on :22-02-2016
Texas Instruments Technical Paper:-

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){ ...}

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

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

# define MAX 100
# define MIN 100
....
....
if(x>MAX)
x=1;
else if(x
x=-1;

x=50;
if the initial value of x=200,what is the value after executing this code?

a) 200
b) 1
c) -1
d) 50

Q22. Which of the following represents true statement either x is in the range of 10 and 50 or y is Zero?

a) x >= 10 && x <= 50 || y = = 0
b) x<50
c) y!=10 && x>=50
d) None of these

Q23. What is the value of y in the following code?

x=7;
y=0;
if(x=6) y=7;
else y=1;

a) 7
b) 0
c) 1
d) 6

FreshersLive - No.1 Job site in India. Here you can find latest 2019 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.

 ✖