TCS NQT Questions and Answers | TCS NQT Questions 2021 | TCS NQT Coding Questions PDF
In this article TCS NQT Questions and Answers you will get all the sample and frequently asked questions, which will help you in attending TCS NQT exam.
A. File inclusion
B. Selective inclusion
C. Conditional compilation
D. Recursive macros
Explanation:
Conditional compilation is the preprocessor facility to produce different executable.
A. true
B. false
C. Depends on the standard
D. Depends on the platform
Explanation:
pragma is compiler specific feature.
A. Selective inclusion
B. macro substitution
C. Concatenation
D. Line control
A. #ifdef
B. #define
C. #endif
D. All of the mentioned.
A. #
B. $
C. ” ”
D. None of the mentioned
define a 20
int main()
{
const int a = 50;
printf(“a = %d\n”, a);
}
A. a = 50
B. a = 20
C. Run time error
D. Compilation Error
Explanation:
The #define substitutes a with 20 leaving no identifier and hence compilation error.
Complilation Error: expected identifier or ‘(’ before numeric constant
int main()
{
int var = 010;
printf(“%d”, var);
}
A. 2
B. 8
C. 9
D. 10
Explanation:
010 is octal representation of 8.
A. Compiler
B. Preprocessor
C. Linker
D. Assembler
int main()
{
const int a;
a = 32;
printf(“a is %d”, a);
return 0;
}
A. a is 32
B. Compile time error
C. Run time error
D. none
Explanation:
Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
int const print()
{
printf(“Cybertecz.in”);
return 0;
}
void main()
{
print();
}
A. Cybertecz.in is printed infinite number of times
B. Cybertecz.in
C. Runtime Error
D. complilation error
int main()
{
int k;
{
int k;
for (k = 0; k < 10; k++);
}
}
A. Yes
B. No
C. Depends on the compiler
D. Depends on the C standard implemented by compilers
void main()
{
int k = 4;
float k = 4;
printf(“%d”, k)
}
A. Compile time error
B. 4
C. 4.0000000
D. 4.4
Explanation:
Since the variable k is defined both as integer and as float, it results in an error.
A. True
B. False
C. True if it is declared static
D. None of the mentioned
Explanation:
Since the scope of the variable declared within a function is restricted only within that function,
the above statement is false.
A. True
B. False
C. May be
D. None of the mentioned.
Explanation:
Since the scope of the variable declared within a function is restricted only within that function, the same name can be used to declare another variable in another function.
A. 31
B. 63
C. 12
D. 14
Explanation:
ISO C99 compiler may consider only first 63 characters for internal.
A. int __a3;
B. int __3a;
C. int __A3;
D. None of the mentioned.
A.Compiler and linker implementations
B. Assemblers and loaders implementations
C. C Language
D. None
Explanation:
It depends on the standard to which compiler and linkers are adhering to.
A. int number;
B. float rate;
C. int variable_count;
D. int $main;
Explanation:
Since only underscore and no other special character is allowed in a variable name, it results in an error.
A. int my_num = 100,000;
B. int my_num = 100000;
C. int my num = 1000;
D. int $my_num = 10000;
Explanation:
space, comma and $ cannot be used in a variable name.
int main()
{
int y = 10000;
int y = 34;
printf(“Hello World! %d\n”, y);
return 0;
}
A. Compile time error
B. Hello World! 34
Explanation:
Since y is already defined, redefining it results in an error.
A. float PI = 3.14;
B. double PI = 3.14;
C. int PI = 3.14;
D. #define PI 3.14
Explanation:
define PI 3.14 is a macro preprocessor, it is a textual substitution.
A. Volatile
B. True
C. friend
D. export
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf(“2 “);
}
A. 2 2
B. 2
C. Compile time error
D. Depends on the compiler
Explanation:
Even though the answer is 2, this code will compile fine only with gcc. GNU C supports nesting of functions in C as a language extension where as standard C compiler doesn’t.
int main()
{
int a = 0, i = 0, b;
for (i = 0;i < 5; i++)
{
a++;
continue;
}
}
A. 2
B. 3
C. 4
D. 5
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf(“Hello”);
}
A. Run time error
B. Hello is printed thrice
C. Hello is printed twice
D. Hello is printed infinitely
For TCS NQT 2021 Interview Questions, English and Programming Set 1: Click here
For TCS NQT 2021 Interview Questions, English and Programming Set 2: Click here
TCS NQT Programming Questions | TCS Coding Questions 2021 Set 3: Click here
TCS NQT 2020 Coding Questions With Answers | TCS NQT Programming Logic Questions Set 4: Click here
TCS NQT 2021 Aptitude Questions Set: Click here
Technical Interview Questions of TCS: Click here
HR Interview Questions of TCS: Click here
How To Write Resume For Getting Shortlisted In TCS: Click here
If You Want To Get More Daily Such Jobs Updates, Career Advice Then Join the Telegram Group From Given Link And Never Miss Update.
Join Telegram Group of Daily Jobs Updates for 2010-2021 Batch: Click Here
TCS NQT 2020 Programming Logic Coding Questions With Answer: Click here
Why You’re Not Getting Response From Recruiter?: Click here
Top 5 High Salary Jobs in India IT Sector 2020: Click here
How To Get a Job Easily: Professional Advice For Job Seekers: Click here
Cognizant Latest News: Up To 20K+ Employees Will Be Hired: Click here
Jio vs Airtel vs Vodafone- Idea 2 Gb Per Day Data Plan Comparison: Click here
Lenovo Legion Three Gaming Laptops Launched In India: Click here
COVID-19 Live Tracker India & Coronavirus Live Update: Click here
Career Tips for Freshers: Top 7 Hacks To Land Your Target Job: Click here
Feel Like Demotivated? Check Out our Motivation For You: Click here
List of Best Sites To Watch Free Movies Online in 2020: Click here
5 Proven Tips For How To Look Beautiful and Attractive: Click here
Home Workouts During The Lockdown For Fitness Freaks: Click here
Google Certification 100,000 Courses For Online Certificates: Click here