Programming for Problem Solving (3110003) MCQs

MCQs of Array & String

Showing 31 to 35 out of 35 Questions
31.
Which function appends not more than n characters?
(a) strcat()
(b) strncat()
(c) strcon()
(d) None of these
Answer:

Option (b)

32.
Which of the given options compares at most n characters of string ch to string s?
(a) strncmp(ch, s, n)
(b) strncmp(s, ch, n)
(c) strcmp(ch, s)
(d) strcmp(s, ch)
Answer:

Option (a)

33.
What is the output?

void main()
{
    char str1[20]="Hello",str2[20]=" World";
    printf("%s\n", strcpy(str1, strcat(str1, str2)));
}

(a) Hello
(b) Hello World
(c) WorldHello
(d) None of these
Answer:

Option (b)

34.
Which function will you use to find the last occurrence of a character in a string?
(a) strnchar()
(b) strrchar()
(c) strchar()
(d) strrchr()
Answer:

Option (b)

35.
The char data type in C program occupies ______ byte of space in memory.
(a) 1
(b) 2
(c) 4
(d) None of these
Answer:

Option (a)

Showing 31 to 35 out of 35 Questions