0% found this document useful (0 votes)
33 views4 pages

Tcs Ninja 6text Paper

Uploaded by

Harshit Pathak
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)
33 views4 pages

Tcs Ninja 6text Paper

Uploaded by

Harshit Pathak
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/ 4

The TCS test Sampus seasons will have four sections:

1) Section-1 Quantitative Test

2) Section-2 Verbal Test (Test on Written English skills)

3) Section-3 Test on Programming Language Proficiency (based on ‘C’)

4) Section-4 Coding test (C Language)

Question 1: 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. Round to (1.66)

Answer: A

/* Example for ceil() and floor() functions: */

#include<stdio.h>

#include<math.h>

int main()

printf("\n Result : %f" , ceil(1.44) );

printf("\n Result : %f" , ceil(1.66) );

printf("\n Result : %f" , floor(1.44) );

printf("\n Result : %f" , floor(1.66) );

return 0;
}

// Output:

// Result : 2.000000

// Result : 2.000000

// Result : 1.000000

// Result : 1.000000

Question 2: What will be the output of the program?

#include<stdio.h>

int X=40;

int main()

int X=20;

printf("%d\n", X);

return 0;

A.20

B.40

C.Error

D.No Output

Answer: A

Whenever there is conflict between a local variable and global variable, the local variable
gets priority.

Question 3: A long double can be used if range of a double is not enough to accommodate
a real number.

A. True
B. False
Answer: A

True, we can use long double; if double range is not enough.

Double = 8 bytes.
Long double = 10 bytes.

Question 4: A float is 4 bytes wide, whereas a double is 8 bytes wide.

A.True

B. False

Answer: A

True,
float = 4 bytes.
Double = 8 bytes.

Question 5: If the definition of the external variable occurs in the source file before its use
in a particular function, then there is no need for an extern declaration in the function.

A. True
B. False
Answer: A

True, when a function is declared inside the source file, that function (local function) get a
priority than the extern function. So there is no need to declare a function as extern inside
the same source file

Question 6: If the definition of the external variable occurs in the source file before its use
in a particular function, then there is no need for an extern declaration in the function.

A. True
B. False
Answer: A

True, When a function is declared inside the source file, that function(local function) get a
priority than the extern function. So there is no need to declare a function as extern inside
the same source file

Question 7: Size of short integer and long integer can be verified using the size of()
operator.

A. True
B. False
Answer: A
True, we can find the size of short integer and long integer using the sizeof() operator.

Question 8: Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform - Turbo C under DOS)

A. True
B. False
Answer: B

False, the range of double is -1.7e-308 to 1.7e+308.

Question 9: Size of short integer and long integer would vary from one platform to another.

A. True
B. False
Answer: A

True, Depending on the operating system/compiler/system architecture you are working on,
the range of data types can vary.

Question 10: Range of float id -2.25e-308 to 2.25e+308

A. True
B. False
Answer: Option B

False, the range of float is -3.4e-38 to 3.4e+38.

You might also like