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 23

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

#include<stdio.h>

int main()

{

    printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));

    return 0;

}

8, 1, 4

4, 2, 8

4, 2, 4

10, 3, 4

SHOW ANSWER

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 empty");

    else

        printf("The string is not empty");

    return 0;

}

The string is empty

The string is not empty

No output

No output

SHOW ANSWER

If char=1, int=4, and float=4 bytes size, What will be the output of the program ?

#include<stdio.h>

int main()

{

    char ch = 'A';

    printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));

    return 0;

}

1, 2, 4

1, 4, 4

2, 2, 4

2, 4, 8

SHOW ANSWER

If the size of pointer is 32 bits What will be the output of the program ?

#include<stdio.h>

int main()

{

    char a[] = "Visual C++";

    char *b = "Visual C++";

    printf("%d, %d", sizeof(a), sizeof(b));

    printf("%d, %d", sizeof(*a), sizeof(*b));

    return 0;

}

10, 2

    2, 2

10, 4

    1, 2

11, 4

    1, 1

12, 2

    2, 2

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    static char mess[6][30] = {"Don't walk in front of me...",

                               "I may not follow;",

                               "Don't walk behind me...",

                               "Just walk beside me...",

                               "And be my friend." };

 

    printf("%c, %c", *(mess[2]+9), *(*(mess+2)+9));

    return 0;

}

t, t

k, k

n, k

m, f

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str1[] = "Hello";

    char str2[10];

    char *t, *s;

    s = str1;

    t = str2;

    while(*t=*s)

        *t++ = *s++;

    printf("%s", str2);

    return 0;

}

Hello

HelloHello

No output

ello

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str[] = "AstiwzQUIZ";

    printf("%d", sizeof(str));

    return 0;

}

10

6

5

11

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str[25] = "ASTIWZ";

    printf("%s", &str+2);

    return 0;

}

Garbage value

Error

No output

diaQUIZ

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str = "ASTIWZ";

    printf("%s", str);

    return 0;

}

Error 

 ASTIWZ 

 Base address of str 

 No output

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str[] = "Nagpur";

    str[0]='K';

    printf("%s, ", str);

    str = "Kanpur";

    printf("%s", str+1);

    return 0;

}

Kagpur, Kanpur 

 Nagpur, Kanpur 

Kagpur, anpur

Error

SHOW ANSWER

. What will be the output of the program ?

#include<stdio.h>

int main()

{

    printf(5+"ASTIWZ");

    return 0;

}

Error

ASTIWZ

QUIZ

None of above

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

#include<string.h>

int main()

{

    char sentence[80];

    int i;

    printf("Enter a line of text");

    gets(sentence);

    for(i=strlen(sentence)-1; i >=0; i--)

        putchar(sentence[i]);

    return 0;

}

The sentence will get printed in same order as it entered

The sentence will get printed in reverse order

Half of the sentence will get printed

None of above

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

void swap(char *, char *);

int main()

{

    char *pstr[2] = {"Hello", "ASTIWZ"};

    swap(pstr[0], pstr[1]);

    printf("%s%s", pstr[0], pstr[1]);

    return 0;

}

void swap(char *t1, char *t2)

{

    char *t;

    t=t1;

    t1=t2;

    t2=t;

}

ASTIWZ

    Hello

Address of "Hello" and "ASTIWZ"

Hello

    ASTIWZ

Iello

    HndiaQUIZ

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