You are on page 1of 44

Talent Battle LiveTraining

TCS Specific
TechnicalTraining
P24. write a program to convert Decimal to Hex
P25. write a program to convert BinaryToDecimal
P26. Fibonacci Series
P27. Nth Fibonacci Number
P28. write a program to find out LCMof two Numbers

Example
4 & 10 =20
3 & 25 =75
P29. write a program to find out Roots of Quadratic Equation if a b and c is
given.
P30. write a program to find out Distance between twopoints if
coordinates of two points aregiven
Programs on Array Iterations
P31. Search a number in an array
P32.
P33.
P34. write a program to find second last occurrence of number in array
P35. Write a program to find Diagonal Difference between nXn array
P36. Write a program to count and display character occurrences in given word
Q36. What is the output of the following code statements? The compiler saves the first integer at the memory
location 4165 and the rest at consecutive memory spaces in order of declaration. Integer is one byte long.
Q36.

Answer: 40
Q37. A data type is stored as a 6 bit signed integer. Which of the following cannot be represented by this
data type?

A. -12
B. 32
C. 18
D. 6
Q36.

Answer: B (32)
Q37. A 10-bit unsigned integer has the followingrange

A. 0 to 1000
B. 0 to 1024
C. 1 to1025
D. 0 to 1023
Q37.

Answer: D (0 to 1023)
Q38 .Parul takes as input two numbers: a and b. a and b can take integer values
between 0 and 255. She stores a, b and c as 1-byte data type. She writes the following
code statement to process a and b and put the result in c.
c = a + 2*b
Toher surprise her program gives the right output with some input values of a and b,
while gives an erroneous answer for others. For which of the following inputs will it
give a wrong answer?
Q38.
Answer: a = 10 & b=200
Q39. Which is used to convert source code to target language
Q. 40
Q40.
Answer: 40
Q41.
Consider the following function

function calculate( n )
{
if(n equals 5)
return 5
else
return (n + calculate(n-5))
end
}

Shishir calls the function by the statement, calculate(20).


What value will the function return?
A. 50
B. 200
C. 35
D. 20
Q41.
Answer: A(50)
Q42. Talika wants to implement heterogeneous linked list for her
project. Which of the following will help her do the same.

A. Void Pointer
B. Int pointer
C. Null Pointer
D. You can not form Heterogeneous datatypes
Q42.

• Answer: A (Voidpointer)
Q43.
A. Print a*b/c-d
B. Print a*b/(c-d)

Where a =40, b =35, c=20, d =10


Comment about the output of the Above two (A & B) statements

A.Differ by 80

B.Same

C.Differ by 50

D.Differ by 160
Q43.
Answer: A (differ by 80)
Q44
What is the output of thefollowing pseudo code?

Int a =456,b,c,d=10;
b=a/d;
c=a-b;
print c;

A. 411.4
B. 411
C. 410.4
D. 410
Q44.
Answer: B(411)
Q45. The value of EOFis

a) -1

b) 0

c) 1

d) 10
Q45.
Answer: A(-1)
Q46. If there is any error while opening a file, fopen will return

A. Nothing

B. EOF

C. NULL

D. Depends on compiler
Q46.
Answer: C(NULL)
Q47. What will be output of the following program

int main()
{
float a[]={12.4, 2.3, 4.5,6.7};

printf(“%d, %d”, sizeof(a), sizeof(a[0]));

return 0;
}

A. 16 bytes, 4 bytes
B. 4 bytes, 4 bytes
C.8 bytes, 4 bytes
D. None of these
Q47.
Answer: A (16 bytes & 4bytes)
Q48 .What is the outputof this Ccode?

#include <stdio.h>
static int i;
void main()
{
int i;
printf(“i is %d”, i);
}

A. 0
B. Garbage Value
C.Run time error
D.Nothing
Q.49
Answer: B
Q50. What is the output of following code

#include <stdio.h>
static int x = 5;
void main()
{
x = 9;
{
int x = 4;
}
printf(“%d”, x);
}
A. 9
B.4
C.5
D. 0
Q50.
Answer: A(9)

You might also like