The following information has been shared by TCS.
rnThe TCS test for 2017-2018 campus seasons will have four sections:
rn1) Section-1 Quantitative Test
rn2) Section-2 Verbal Test (Test on Written English skills)
rn3) Section-3 Test on Programming Language Proficiency (based on ‘C’)
rn4) Section-4 Coding test (C Language)
rnWhile practice tests for Section-1 and 2 are available in TCS Campus Commune portal in “Open Seesame”, Sections 3 & 4 are new sections and we have not been able to incorporate the same into ‘Open Seesame’ yet.
rnHence attaching a few sample questions from Sections 3 & 4 so that students who are TCS aspirants can start practicing in these lines.
rnSection 3: C Language concepts
rnQ1: What is the output of this C code?
rn#include <stdio.h>
rnvoid main()
rn{
rnint k = 5;
rnint *p = &k;
rnint **m = &p;
rnprintf(“%d%d%dn”, k, *p, **p);
rn}
rnrn
a) 5 5 5
rnb) 5 5 junk
rnc) 5 junk junk
rnd) Compile time error
rnQ2. Which of the following statements about stdout and stderr are true?
rna) They both are the same
rnb) Run time errors are automatically displayed in stderr
rnc) Both are connected to the screen by default.
rnd) stdout is line buffered but stderr is unbuffered.
rnQ3: Given the below statements about C programming language;
rn1) main() function should always be the first function present in a C program file
rn2) all the elements of an union share their memory location
rn3) A void pointer can hold address of any type and can be typcasted to any type
rn4) A static variable hold random junk value if it is not initialised
rnWhich of the above are correct statements?
rnA) 2,3
rnB) 1,2
rnC) 1,2,3
rnD) 1,2,3,4
rnQ4 If a function is defined as static, it means
rnA) The value returned by the function does not change
rnB) all the variable declared inside the function automatically will be assigned initial value of zero
rnC) It should be called only within the same source code / program file.
rnD) None of the other choices as it is wrong to add static prefix to a function
rnQ5: Comment on the below while statement
rnwhile (0 == 0) { }
rnA) It has syntax error as there are no statements within braces {}
rnB) It will run forever
rnC) It compares 0 with 0 and since they are equal it will exit the loop immediately
rnD) It has syntax error as the same number is being compared with itself
rnSection 4 Coding
rnQ1 : Write a C program to calculate the factorial of a non-negative integer N. The factorial of a number N is defined as the product of all integers from 1 up to N. Factorial of 0 is defined to be 1. The number N is a non-negative integer that will be passed to the program as the first command line parameter. Write the output to stdout formatted as an integer WITHOUT any other additional text. You may assume that the input integer will be such that the output will not exceed the largest possible integer that can be stored in an int type variable.
rnQ2: Write a C program to find the area of a triangle given the base and the corresponding height. The values base and height are both positive integers passed to the program as the first and second command line parameters respectively. Write the output to stdout formatted as a floating point number rounded to EXACTLY 2 decimal precision WITHOUT any other additional text. Scientific format(such as 1.00E+5) should NOT be used while printing the output. You may assume that the inputs will be such that the output will not exceed the largest possible real number that can be stored in a float type variable.
rnFACE Prep has a comprehensive course for your complete Aptitude Preparation and TCS preparation.
Check out our Aptitude Course here.
Check out our TCS Course here.