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 22

How will you print on the screen?

printf("");

echo "";

printf('');

printf("");

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    printf(5+"Good Morning");

    return 0;

}

Good Morning

Good

M

Morning

SHOW ANSWER

Which of the following statement is correct?

strcmp(s1, s2) returns a number less than 0 if s1>s2

strcmp(s1, s2) returns a number greater than 0 if s1<s2

strcmp(s1, s2) returns 0 if s1==s2

strcmp(s1, s2) returns 1 if s1==s2

SHOW ANSWER

The library function used to find the last occurrence of a character in a string is

strnstr()

laststr()

strrchr()

strstr()

SHOW ANSWER

What will be the output of the program ?

#include

#include

int main()

{

    char str[] = "AstiwzQUIZ";

    printf("%s", str);

    return 0;

}

QUIZ

Astiwz

Astiwz QUIZ

Astiwz QUIZ

SHOW ANSWER

Which of the following function is used to find the first occurrence of a given string in another string?

strchr()

strrchr()

strstr()

strnset()

SHOW ANSWER

What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input?

#include<stdio.h>

int main()

{

    void fun();

    fun();

    printf("");

    return 0;

}

void fun()

{

    char c;

    if((c = getchar())!= '')

        fun();

    printf("%c", c);

}

abc abc

bca

Infinite loop

cba

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    printf("Astiwz", "QUIZ");

    return 0;

}

Error

Astiwz QUIZ

Astiwz

QUIZ

SHOW ANSWER

Which of the following function is correct that finds the length of a string?

int xstrlen(char *s)

{

    int length=0;

    while(*s!='')

    {    length++; s++; }

    return (length);

}

int xstrlen(char s)

{

    int length=0;

    while(*s!='')

        length++; s++;

    return (length);

}

int xstrlen(char *s)

{

    int length=0;

    while(*s!='')

        length++;

    return (length);

}

int xstrlen(char *s)

{

    int length=0;

    while(*s!='')

        s++;

    return (length);

}

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char str[7] = "ASTIWZ";

    printf("%s", str);

    return 0;

}

Error

ASTIWZ

Cannot predict

None of above

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

int main()

{

    char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"};

    int i;

    char *t;

    t = names[3];

    names[3] = names[4];

    names[4] = t;

    for(i=0; i<=4; i++)

        printf("%s,", names[i]);

    return 0;

}

Suresh, Siva, Sona, Baiju, Ritu

Suresh, Siva, Sona, Ritu, Baiju

Suresh, Siva, Baiju, Sona, Ritu

Suresh, Siva, Ritu, Sona, Baiju

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

#include<string.h>

int main()

{

    char str[] = "AstiwzQUIZ";

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

    return 0;

}

10

6

5

11

SHOW ANSWER

What will be the output of the program ?

#include<stdio.h>

#include<string.h>

int main()

{

    static char str1[] = "dills";

    static char str2[20];

    static char str3[] = "Daffo";

    int i;

    i = strcmp(strcat(str3, strcpy(str2, str1)), "Daffodills");

    printf("%d", i);

    return 0;

}

0

1

2

4

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