TCS - C Programming Concept MCQ - Set 2

TCS NQT Programming MCQ 

TCS NQT Programming MCQ - SimpleWay2Code



1. How many times loop will executed ?
#include<stdio.h>
int main()
{
int x,y;
for(x=5;x>=1;x--)
{
for(y=1;y<=x;y++)
printf("%d\n",y);
}
}
a) 11
b) 13
c) 15
d) 10

2. Which of the following indicate the end of file ?
a) feof()
b) EOF
c) Both feof() and EOF
d) None of the mentioned

3. If a functions return type is not explicitly defined then it is default to ..........(in C).
a) int
b) float
c) void
d) error

4. Where the local variable is stored ?
a) Disk
b) Stack
c) Heap
d) Register

5. How many times loop will executed ?
#include<stdio.h>
int main()
{
int i;
for(i=0;i<5;i++)
{
printf("Hello\n");
}
}

a) 0
b) 1
c) 3
d) 5

6. What is dangling pointer?
a) points to garbage value 
b) points to function
c) Both A and B
d) None of these

7. what is the purpose of ftell ?
a)to get the current file position
b)to get the current file attribute
c)to get the current file status
d)to get the current file name

8. What is recursion ?
a) looping
b) a function calls another function repeatedly
c) a fnction calls repeatedly
d) function calls itself repeatedly

9. What is the similarity between enum and struct ?
a) can assign new values
b) can create new data types
c) nothing in common
d) they are same

10. which of the following is not a fundamental datatype?
a) Enum
b) unsigned long int
c) Long int
d) double

11. How many times hello will print ?
#include<stdio.h>
int main(void)
{
int i;
for(i=0;i<5;i++);
printf("hello");
}

a) Compilation error
b) Runtime error
c) 4
d) 1

Post a Comment

13 Comments

  1. very useful questions please upload more questions

    ReplyDelete
    Replies
    1. I am working on this blog and will upload more questions soon

      Delete
  2. Can anyone explain the last question?

    ReplyDelete
    Replies
    1. In the last question there is a semicolon after for loop, so printf will work only once.

      Delete
    2. @Harishabh
      Don't u think same goes for Q5.??

      Delete
    3. No , there is no termination of for loop i.e no semicolon at the end of for statement so control enters into loop and executes 5 times and prints it 5 times.

      Delete
    4. @unknown
      yes, u r right. I just misread the question. Thank u anyway

      Delete
  3. can u plz provide more aptitude, technical and coding question asked in TCS?

    ReplyDelete
  4. How much time takes to declare TCS aptitude result

    ReplyDelete
    Replies
    1. Previosly It was declaring its result within one or two days but from few past experiences, I think it can take upto a week or in some cases around 10 days.

      Delete
  5. Plz upload more questions

    ReplyDelete
  6. is there any chance the same like questions asked in drive?

    ReplyDelete
    Replies
    1. Any thing can happen. It might repeat but no sure. Keep yourself prepared.

      Delete