Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?
Answer: B
The function char *strrchr(ch, c) returns pointer to last occurrence of c in ch or NULL if not present.
Enter details here
If the size of pointer is 4 bytes then What will be the output of the program ?
#include
int main()
{
char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
printf("%d, %d", sizeof(str), strlen(str[0]));
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
int main()
{
char *str = "hello, world";
char str1[15] = "hello wo 9";
strcpy(str, str1);
printf("%s", str1);
}
Answer: B
No answer description available for this question.
Enter details here
Which of the following is the variable type defined in header string. h?
Answer: C
This is the unsigned integral type and is the result of the sizeof keyword.
Enter details here
What will be the output of the following C code?
#include
int main()
{
char *str = "hello, world\n";
printf("%d", strlen(str));
}
Answer: C
No answer description available for this question.
Enter details here
#include
int main()
{
char *str1 = "GeeksQuiz";
char str2[] = "GeeksQuiz";
printf("sizeof(str1) = %d, sizeof(str2) = %d",
sizeof(str1), sizeof(str2));
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
int main()
{
char str[] = "India\0BIX\0";
printf("%d\n", sizeof(str));
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
What will the following C code do?
char * strrchr(const char *s, int c )
char ch = c;
char *sc;
for(sc = NULL; ; ++s)
if(*s == ch)
SC = 9;
i f (*s =='\O' )
return (( char *) s);
Answer: A
The strrchr() function locates the last occurrence of c (converted to a char) in the string pointed to by s. String contains null character as a terminating part of it.
Enter details here
#include
void my_toUpper(char* str, int index)
{
*(str + index) &= ~32;
}
int main()
{
char* arr = "geeksquiz";
my_toUpper(arr, 0);
my_toUpper(arr, 5);
printf("%s", arr);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
In below program, what would you put in place of “?” to print “Quiz”?
#include
int main()
{
char arr[] = "GeeksQuiz";
printf("%s", ?);
return 0;
}
Answer: B
No answer description available for this question.
Enter details here