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 8 of 14

Explore more Topics under C Programming

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

int main()
{
    char t;
    char *p1 = "CompSci", *p2;
    p2=p1;
    p1 = "Bits";
    printf("%s %s\n", p1, p2);
    return 0;
}
Discuss
Answer: (a).Bits CompSci
Q72.
What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    printf("%c\n", "abcdefgh"[4]);
    return 0;
}
Discuss
Answer: (c).e
Q73.
What will be the output of the following program in 16 bit platform assuming that 1022 is memory address of the string "Hello1" (in Turbo C under DOS) ?
#include<stdio.h>

int main()
{
    printf("%u %s\n", &"Hello1", &"Hello2");
    return 0;
}
Discuss
Answer: (a).1022 Hello2
Q74.
Which of the following statements are correct about the program below?
#include<stdio.h>

int main()
{
    char str[20], *s;
    printf("Enter a string\n");
    scanf("%s", str);
    s=str;
    while(*s != '\0')
    {
        if(*s >= 97 && *s <= 122)
            *s = *s-32;
        s++;
    }
    printf("%s",str);
    return 0;
}
Discuss
Answer: (b).The code converts lower case character to upper case
Q75.
Which of the following statements are correct about the below declarations?
char *p = "Sanjay";char a[] = "Sanjay";

1: There is no difference in the declarations and both serve the same purpose.

2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing to a non-const pointer.

3: The pointer p can be modified to point to another string, whereas the individual characters within array a can be changed.

4: In both cases the '\0' will be added at the end of the string "Sanjay".
Discuss
Answer: (b).2, 3, 4
Q76.
Which of the following statements are correct ?

1: A string is a collection of characters terminated by '\0'.
2: The format specifier %s is used to print a string.
3: The length of the string can be obtained by strlen().
4: The pointer CANNOT work on string.
Discuss
Answer: (b).1, 2, 3
Q77.
Length of the string "compsciedu" is
Discuss
Answer: (b).10
Q78.
How will you print ' ' on the screen?
Discuss
Answer: (c).printf("\n");
Q79.
Which of the following statements are correct ?

1. A string is a collection of characters terminated by '.
2. The format specifier %s is used to print a string.
3. The length of the string can be obtained by strlen().
4. The pointer CANNOT work on string.
Discuss
Answer: (a).1,2,3
Q80.
Let x be an array.Which of the following operations is illegal?

i) ++x.
ii) x+1.
iii) x++.
iv) x*2.
Discuss
Answer: (d).II and III

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!