1. Question: Which of the following is not a valid mode for opening a file?

    A
    r

    B
    w

    C
    a

    D
    r+

    E
    i

    Note: Not available
    1. Report
  2. Question: Given the following array:
    char books[][40]={
                             "The Little World of Don Camillo",
                             "To Kill a Mockingbird",
                             "My Family and Other Animals",
                             "Birds, Beasts and Relatives"
                              };
    what would be the output of printf("%c",books[2][5]);?

    A
    m

    B
    M

    C
    F

    D
    i

    E
    L

    Note: Not available
    1. Report
  3. Question: What would be printed on the standard output as a result of the following code snippet?
    char *str1 = "Hello World";
    strcat(str1, '!');
    printf("%s", str1);

    A
    Hello World!

    B
    Hello World

    C
    Hello

    D
    The code snippet will throw a compilation error

    E
    H

    Note: Not available
    1. Report
  4. Question: What will be printed on the standard output as a result of the following code snippet?
    void main()
    {
            char arr[] = {'R','A','M','\0'};
            printf("%d",strlen(arr));
    }

    A
    0

    B
    1

    C
    3

    D
    4

    E
    Cannot be determined

    Note: Not available
    1. Report
  5. Question: Given the following array:
    int a[8] = {1,2,3,4,5,6,7,0};
    what would be the output of printf("%d",a[4]); ?

    A
    3

    B
    4

    C
    5

    D
    6

    E
    7

    Note: Not available
    1. Report
  6. Question: In order to read structures/records from a file, which function will you use?

    A
    fscanf()

    B
    fread()

    C
    fgets()

    D
    fgetc()

    E
    fseek

    Note: Not available
    1. Report
  7. Question: An array is defined with the following statement in a file, file1.c
    int a[ ] = { 1, 2, 3, 4, 5, 6 };
    In another file, file2.c, the following code snippet is written to use the array a:
    extern int a[];
    int size = sizeof(a);
    What is wrong with the above code snippet?

    A
    The size of the operator cannot be applied to an array

    B
    The size of the operator cannot be applied to an array

    C
    There is nothing wrong with the code snippet. The value of the size will be 7

    D
    An extern array of unspecified size is an incomplete type. The size of the operator during compile time is unable to learn the size of an array that is defined in another file

    E
    None

    Note: Not available
    1. Report
  8. Question: What would be printed on the standard output as a result of the following code snippet?
    main()
    {
            char *s="Hello World";
            char s1[20], s2[20];
            int len = sscanf(s,"%s",s1);
            printf("%s : %d", s1, len);
    }

    A
    Compilation Error

    B
    Hello World : 11

    C
    Hello World : 1

    D
    Hello : 5

    E
    Hello : 1

    Note: Not available
    1. Report
  9. Question: Suppose there is a file a.dat which has to be opened in the read mode using the FILE pointer ptr1, what will be the correct syntax?

    A
    ptr1 = open("a.dat");

    B
    ptr1 = fileopen("a.dat");

    C
    ptr1 = fopen("a.dat","r");

    D
    ptr1 = open("a.dat","r");

    E
    ptr1 = fileopen("a.dat","r");

    Note: Not available
    1. Report
  10. Question: Given the following array:
    char books[][40]={
                             "The Little World of Don Camillo",
                             "To Kill a Mockingbird",
                             "My Family and Other Animals",
                             "Birds, Beasts and Relatives"
                             };
    what would be the output of printf("%s",books[3]);?

    A
    Birds

    B
    B

    C
    Birds, Beasts and Relatives

    D
    My Family and Other Animals

    E
    M

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