Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C PROGRAM QUESTIONS : PART 24

What will be the output of the program ?

#include<stdio.h>

int main()

{

    int i;

    char a[] = "";

    if(printf("%s", a))

        printf("The string is not empty");

    else

        printf("The string is empty");

    return 0;

}

The string is not empty 

The string is empty

No output

0

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

#include<string.h>

int main()

{

    char str1[5], str2[5];

    int i;

    gets(str1);

    gets(str2);

    i = strcmp(str1, str2);

    printf("%d", i);

    return 0;

}

Unpredictable integer value

0

-1

Error

SHOW ANSWER

What will be the output of the program in Turbo C?

#include<stdio.h>

int main()

{

    char str[10] = "Astiwz";

    str[6] = "QUIZ";

    printf("%s", str);

    return 0;

}

Astiwz QUIZ

QUIZ

Astiwz

Error

SHOW ANSWER

. What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str1[] = "Hello";

    char str2[] = "Hello";

    if(str1 == str2)

        printf("Equal");

    else

        printf("Unequal");

    return 0;

}

Equal

Unequal

Error

None of above

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char t;

    char *p1 = "Astiwz", *p2;

    p2=p1;

    p1 = "QUIZ";

    printf("%s %s", p1, p2);

    return 0;

}

Astiwz QUIZ

QUIZ Astiwz

Astiwz Astiwz

QUIZ QUIZ

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

#include<string.h>

int main()

{

    printf("%c", "abcdefgh"[4]);

    return 0;

}

Error

d

e

abcdefgh

SHOW ANSWER

What will be the output of the following program in 16 bit platform (in Turbo C under DOS) ?

#include<stdio.h>

int main()

{

    printf("%u %s", &"Hello", &"Hello");

    return 0;

}

177 Hello

Hello 177

Hello Hello

Error

SHOW ANSWER

What does the following fragment of C-program print?

char c[] = "GATE2011";

char *p =c;

printf("%s", p + p[3] - p[1]) ;

GATE2011

E2011

2011

011

SHOW ANSWER

Which of the following true about FILE *fp 

FILE is a keyword in C for representing files and fp is a variable of FILE type. 
FILE is a stream
FILE is a buffered stream
FILE is a structure and fp is a pointer to the structure of FILE type
SHOW ANSWER

Which of the following mode argument is used to truncate?

a
w
f
 t
SHOW ANSWER

The first and second arguments of fopen() are

A character string containing the name of the file & the second argument is the mode
A character string containing the name of the user & the second argument is the mode
A character string containing file pointer & the second argument is the mode
None of the mentioned
SHOW ANSWER

FILE is of type ______

int type
char * type
struct type
None of the mentioned
SHOW ANSWER

fseek() should be preferred over rewind() mainly because

rewind() doesn't work for empty files 
rewind() may fail for large files 
In rewind, there is no way to check if the operations completed successfully 
All of the above
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in