0% found this document useful (0 votes)
125 views45 pages

Talent Battle Live Training: Tcs Specific Technicaltraining

The document provides details on three technical training programs offered by Talent Battle LiveTraining: 1. TCSSpecific TechnicalTraining - A program that provides technical training specific to TCScourses. 2. P48-P53 - A series of programming problems and exercises labeled P48 through P53 covering topics like series, highest/second highest scores, validating IP addresses, word counts, checking for prime numbers, and printing patterns. 3. Q84-Q100 - A series of questions labeled Q84 through Q100 covering topics in C programming like functions, unions, data types, operators, loops, conditional statements, and more.

Uploaded by

Jeevan Sai Maddi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views45 pages

Talent Battle Live Training: Tcs Specific Technicaltraining

The document provides details on three technical training programs offered by Talent Battle LiveTraining: 1. TCSSpecific TechnicalTraining - A program that provides technical training specific to TCScourses. 2. P48-P53 - A series of programming problems and exercises labeled P48 through P53 covering topics like series, highest/second highest scores, validating IP addresses, word counts, checking for prime numbers, and printing patterns. 3. Q84-Q100 - A series of questions labeled Q84 through Q100 covering topics in C programming like functions, unions, data types, operators, loops, conditional statements, and more.

Uploaded by

Jeevan Sai Maddi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Talent Battle LiveTraining

TCSSpecific TechnicalTraining
P48. Consider the following series:
1,1,2,3,4,9,8,27,16,81,32,243,64,729,128,2187… This series is
a mixture of 2 series – all the odd terms in this series form a
geometric series and all the even terms form yet another
geometric series. Write a program to find the Nth term in the
odd series.

For example , ifN=16, the 16th term in the series is 2187, so


only value 2187 should be printed to STDOUT.
P49. English teacher informed the highest mark scored in her test in the
class. Your task is to find the second highest mark.
P50. Program to validate IPaddress.
P51. Program to print number of words
P52. Sachin has come up with a program to get 5 numbers from user and check whether
each number is prime or not. Unfortunately there is a bug in his code and he is stuck
fixing it. Help him through. When he gives the following 5 numbers, his code is checking
only the first two numbers (10,17) for prime and does not check for others. 10 17 44 49
88

Input :

12345

Expected Output:
1is prime
2 is prime
3 is prime
4is not prime
5 is prime
P53. write a program to print following pattern

Input :7
Output:
*
**
***
****
*****
******
*******
******
*****
****
***
**
*
Q84. What is the output of the following program?

#include<stdio.h>
void f()
{
static int i;
++i;
printf("%d", i);
}
main()
{
f();
f();
f();
}
Q84
Answer: 1 2 3
Q85. What is the size of the following union definition?
#include<stdio.h>
union abc
{
char a,b,c,d,e,f,g,h;
int i;
}abc;
main()
{
printf( "%d", sizeof( abc ));
}
Q85
• Answer: 4
Q86. With givenprogram
#include<stdio.h> •I - Error in the statement ‘void f(int const i)’
•II - Error in the statement i=5.
void f(int const i)
{
i=5; A . Statements I & II are true
} B . Statements I & II are false.
main() C . Statement I is true
D . Statement II is true.
{
int x = 10;
f(x);
}
Q86.
• Answer: D (function with const. argument)
Q87. what will be the output
#include<stdio.h>
int get();
int main()
{
const int x = get();
printf("%d", x);
return 0;
} A - 40
int get() B - 20
{
return 40;
C-0
} D - Error
Q87.
• Answer: 40
Q88. Consider the 32 bit compiler. We need to store address of integer
variable to integer pointer. What will be the size of integer pointer ?

A. 2 Bytes
B. 4 Bytes
C. 6 Bytes
D. 10 Bytes
Q88.
• Answer: 2 byte
Q87. How would you round off a value from 1.66 to 2.0?

A. ceil(1.66)
B. floor(1.66)
C.roundup(1.66)
D. roundto(1.66)
Q87.
• Answer: A
Q88. Which of the following correctly shows the hierarchyof
arithmetic operations in C?
A. / + * -
B. * - / +
C. + - / *
D. / * + -
Q88
• Answer: D (BODMASRule)
Q89. Which of the following are unary operators inC?
1. !
2. sizeof
3. ~
4. &&

A.1, 2
B.1, 3
C.2, 4
D.1, 2, 3
Q89.
• Answer: D(1,2,3)
Q90. What will be output of program
#include<stdio.h>
int main()
{
static int a[20];
int i =0;
a[i] = i ;
printf("%d, %d, %d\n", a[0], a[1], i);
return 0;
}
Q90.
• Answer: 0,0,0
Q91. What will be the output of the program?

#include<stdio.h>
int main()
{
int x=4,
y, z;
y = --x;
z = x--;
printf("%d, %d, %d\n", x, y, z);
return 0;
}
Q91.
• Answer: 2,3,3
Q92. what will be the output

#include<stdio.h>
int main()
{ int a=100, b=200, c;
c = (a == 100 || b > 200);
printf("c=%d\n", c);
return 0;
}
Q92.
• Answer: 1
Q93. how many times hello will be in output?

#include<stdio.h>
int main() A. Infinite times
{ int x; B.11 times
for(x=-1; x<=10; x++) C.0 times
{ if(x < 5) D.10 times
continue;
else break;
printf(“Hello");
}
return 0;
}
Q93.
• Answer: C
Q94. What will be output of program?

#include<stdio.h> A. b = 300 c = 200


B. b = 100 c = garbage
int main() C. b = 300 c = garbage
{ D. b = 100 c = 200
int a = 500, b = 100, c;
if(!a >= 400)
b = 300;
c = 200;
printf("b = %d c = %d\n",b, c);
return 0;
}
Q94.
• Answer: D (B=100c=200)
Q95. what will be theoutput?

#include<stdio.h>
int main()
{
unsigned int i = 65535;
/* Assume 2 byte
integer*/
while(i++ != 0) A. Infinite loop
printf("%d",++i);
printf("\n"); B. 0 1 2 ... 65535
return 0; C. 0 1 2 ... 32767 - 32766 -32765 -1 0
}
D. No output
Q95.

• Answer: Infinite Loop


Q96. what will be theoutput.

#include<stdio.h>
int main()
{
char ch;
if(ch = printf(""))
printf("It matters\n");
else
printf("It doesn't matter\n");
return 0;
}
Q96.

• Answer: It doesn't matter


Q97. What will be theoutput?
#include<stdio.h>
int main() A. Error
{
int i=3; B. Bye
switch(i) C.No output
{
case 1: printf("Hello\n");
D. Hello Hi
break;
case 2: printf("Hi\n");
break;
case 3: continue;
break;
default: printf("Bye\n");
}
return 0;
}
Q97.

• Answer: A(Error)
Q 98. Select correct option

#include<stdio.h> int main()


{
A. There should be a condition in the forloop
int i=1;
B. The two semicolons should be dropped
for(;;) C.The for loop should be replaced with while loop.
{ D. No error
printf("%d\n", i++);
if(i>10)
break;
}
return 0;
}
Q98
• Answer: No error
Q99. The modulus operator cannot be used witha long double.

A. True
B. False
Q99.

• Answer: True
Q100. What will be the output of program?

#include<stdio.h> A. Output: Have a nice day


int main() B. No output
{ C.Error: Expression syntax
D. Error: Undeclared identifier if
int i = 10, j = 20;
if(i = 5) && if(j = 10)
printf("Have a nice day");
return 0;
}
Q100.

• Answer: Cexpression Syntax Error

You might also like