adplus-dvertising

Welcome to the Strings MCQs Page

Dive deep into the fascinating world of Strings with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Strings, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Strings, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Strings. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Strings. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Strings MCQs | Page 1 of 14

Q1.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    char str1[20] = "Hello", str2[20] = " World";
    printf("%s\n", strcpy(str2, strcat(str1, str2)));
    return 0;
}
Discuss
Answer: (c).Hello World
Q2.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    char p[] = "%d\n";
    p[1] = 'c';
    printf(p, 65);
    return 0;
}

a.

A

b.

a

c.

c

d.

65

Discuss
Answer: (a).A
Q3.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    printf("%d\n", strlen("123456"));
    return 0;
}

a.

6

b.

12

c.

7

d.

2

Discuss
Answer: (a).6
Q4.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    printf(5+"Good Morning\n");
    return 0;
}
Discuss
Answer: (d).Morning
Q5.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    char str[] = "Compsci\0\Bits\0";
    printf("%s\n", str);
    return 0;
}
Discuss
Answer: (b).Compsci
Q6.
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("\n");
    return 0;
}
void fun()
{
    char c;
    if((c = getchar())!= '\n')
        fun();
    printf("%c", c);
}
Discuss
Answer: (d).cba
Q7.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    printf("Compsci", "Bits\n");
    return 0;
}
Discuss
Answer: (c).Compsci
Q8.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    char str[7] = "CompsciBits";
    printf("%s\n", str);
    return 0;
}
Discuss
Answer: (c).Cannot predict
Q9.
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;
}
Discuss
Answer: (b).Suresh, Siva, Sona, Ritu, Baiju
Q10.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    char str[] = "India\0\BIX\0";
    printf("%d\n", strlen(str));
    return 0;
}
Discuss
Answer: (c).5
Page 1 of 14

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!