1. Question: What will be output if you will compile and execute the following c code?
    #include<stdio.h>
    int main(){
      char *str;
      scanf("%[^\n]",str);
      printf("%s",str);
      return 0;
    }
    
     

    A
    It will accept a word as a string from user.

    B
    It will accept a sentence as a string from user.

    C
    It will accept a paragraph as a string from user.

    D
    Compiler error

    E
    None of above


    1. Twitter
    2. Details
  2. Question: What will be output if you will compile and execute the following c code?


    #include<stdio.h>
    int main(){
      float f=3.4e39;
      printf("%f",f);
      return 0;

    A
    3.4e39

    B
    3.40000…

    C
    +INF

    D
    Compiler error

    E
    Run time error


    1. Twitter
    2. Details
  3. Question: What will be output if you will compile and execute the following c code?


    #include<stdio.h>
    int main(){
      float f=5.5f;
      float x;
      x=f%2;
      printf("%f",x);
      return 0;

    A
    1.500000

    B
    1.000000

    C
    5.500000

    D
    Compiler error

    E
    None


    1. Twitter
    2. Details
  4. Question: What will be output if you will compile and execute the following c code?


    #include<stdio.h>
    int main(){
      int a=-20;
      int b=-3;
      printf("%d",a%b);
      return 0;

    A
    2

    B
    -2

    C
    18

    D
    -18

    E
    Compiler error


    1. Twitter
    2. Details
  5. Question: What will be output if you will compile and execute the following c code?


    #include<stdio.h>
    int main(){
      char c='0';
      printf("%d %d",sizeof(c),sizeof('0'));
      return 0;

    A
    1 1

    B
    2 2

    C
    1 2

    D
    2 1

    E
    None


    1. Twitter
    2. Details
  6. Question: What will be output if you will compile and execute the following c code?
    #include<stdio.h>
    int main(){
      float f;
      f=3/2;
      printf("%f",f); 
      return 0;
    }
    
     

    A
    1.5

    B
    1.500000

    C
    1.000000

    D
    Compiler error

    E
    None


    1. Twitter
    2. Details
  7. Question: In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain? 

    A
    "I am a boy\r\n\0"

    B
    "I am a boy\r\0"

    C
    "I am a boy\n\0"

    D
    "I am a boy"


    1. Twitter
    2. Details
  8. Question: What is the purpose of "rb" in fopen() function used below in the code?
    FILE *fp;
    fp = fopen("source.txt", "rb"); 
    
     

    A
    open "source.txt" in binary mode for reading

    B
    open "source.txt" in binary mode for reading and writing

    C
    Create a new file "source.txt" for reading and writing

    D
    None of above


    1. Twitter
    2. Details
  9. Question: What does fp point to in the program ?
    #include<stdio.h>
    int main()
    {
        FILE *fp;
        fp=fopen("trial", "r");
        return 0;
    }
    
     

    A
    The first character in the file

    B
    A structure which contains a char pointer which points to the first character of a file.

    C
    The name of the file.

    D
    The last character in the file.


    1. Twitter
    2. Details
  10. Question: Which of the following operations can be performed on the file "NOTES.TXT" using the below code?
    FILE *fp;
    fp = fopen("NOTES.TXT", "r+");
    
     

    A
    Reading

    B
    Writing

    C
    Appending

    D
    Read and Write


    1. Twitter
    2. Details