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

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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"

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
  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.

    Note: Not available
    1. Report
  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

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd