TCS NQT C-MCQ Set - 6



TCS NQT Programming MCQ - SimpleWay2Code




Ques 1. Which data type is most suitable for storing a number 65000 in a 32-bit system?

A )   short  ✔️
B )   int   
C )   long   
D )   double


Ques 2. All keywords in C are in

A )    LowerCase letters  ✔️
B )    UpperCase letters  
C )   CamelCase letters   
D )    None


Ques 3. Variable name resolving (number of significant characters for uniqueness of variable) depends on

A )    Compiler and linker implementations ✔️ 
B )   Assemblers and loaders implementations   
C )    C language   
D )    None


Ques 4. What is the output of this C code?

 #include <stdio.h>
 int main() {
    float x = ‘a’;
    printf(“%f”, x);
    return 0; 
 }

A )   a   
B )   run time error   
C )   a.0000000   
D )   97.000000 ✔️


Ques 5. Which of the following is not a valid C variable name?

A )   int variable_count   
B )   int number   
C )    float rate   
D )    int $main ✔️

Ques 6. Which is correct with respect to size of the datatypes?

A )   char > int > float   
B )   int > char > float   
C )   char < int < double ✔️ 
D )   double > char > int


Ques 7. Consider on following declaration: 
(i)        short i=10; 
(ii)       static i=10; 
(iii)     unsigned i=10; 
(iv)      const i=10;

A )   Only (iv) is incorrect   
B )   Only (ii) and (iv) are incorrect   
C )   Only (ii),(iii) and (iv) are correct   
D )   All are correct declaration ✔️


Ques 8. Which of the following is not a valid variable name declaration?

A )   float PI = 3.14;   
B )   double PI = 3.14;   
C )   int PI = 3.14;   
D )   #define PI 3.14; ✔️


Ques 9. The format identifier  ‘%i’  is also used for _____ data type?

A )    char  
B )    int  ✔️ 
C )    float   
D )    double


Ques 10. Which of the following is a User-defined data type?

   A )   typedef int Boolean;   
B )   typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;   
C )   struct {char name[10], int age};   
D )   all of the mentioned ✔️


Ques 11. Which of the following is true for variable names in C?

 A ) They can contain alphanumeric characters as well as special characters   
B ) It is not an error to declare a variable to be one of the keywords(like goto, static)   
C ) Variable names cannot start with a digit ✔️
D ) Variable can be of any length


Ques 12. What is the size of an int data type?

A )   4 Bytes   
B )   8 Bytes   
C )   Depends on the system/compiler ✔️ 
D )   Cannot be determined



Ques 13. Literal means ?

A )   a string.   
B )   a string constant. ✔️
C )   a character.   
D )   an alphabet.


Ques 14. What will happen if the below program is executed? 

#include <stdio.h>
 int main() { 
        int main = 3;
        printf(“%d”, main);
        return 0; 
}

A )   It will cause a compile-time error  
B )   It will cause a run-time error   
C )   It will run without any error and prints 3  ✔️ 
D )   It will experience infinite looping


Ques 15. What is the output of this C code?

#include  <stdio.h> 
int main() { 
        char chr;
        chr = 128;  
        printf(“%d\n”, chr); 
        return 0; 
}

A )   128   
B )   -128 ✔️
C )   Depends on the compiler  
D )   None of the mentioned


Ques 16. What is the output of this C code?

#include <stdio.h>
 int main() {
       int y = 10000;
       int y = 34;
      printf(“Hello World! %d\n”,y); 
      return 0;
 }

A )   Compile time error  ✔️
B )   Hello World! 34   
C )   Hello World! 1000   
D )   Hello World! followed by a junk value


Ques 17. Comment on the output of this C code? 

#include <stdio.h>
 int main() { 
        float f1 = 0.1; 
        if (f1 == 0.1) 
            printf(“equal\n”); 
       else
            printf(“not equal\n”);
 }

A )   equal   
B )   not equal ✔️
C )   Output depends on compiler   
D )   None of the mentioned


Ques 18. Which of the following cannot be a variable name in C?

A )   Volatile ✔️ 
B )   true   
C )    friend   
D )   export

Ques 19. Which is valid C expression?

A )    int my_num = 100,000;   
B )    int my_num = 100000; ✔️
C )    int my num = 1000;   
D )    int $my_num = 10000;


Ques 20. 2. What is the output of this C code?

#include <stdio.h>
 int main() { 
       printf(“Hello World! %d\n”, x);
       return 0;
 }


A )   Hello World! x;   
B )   Hello World! followed by a junk value   
C )   Compile time error ✔️  
D )   Hello World!


For More TCS NQT (National Qualifier Test) C-MCQ  Questions

This Blog is Hard work !

Can you give me a treat 😌



Post a Comment

0 Comments