Q. Choose a correct C statement about String functions

  • (A) strlwr("Abc") returns abc
  • (B) int n=strlen("abc") returns 3.
  • (C) strupr("abc") returns ABC
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose a correct C statement about String functions?

  • (A) strcmp("234","123") returns a positive number
  • (B) strrev("abcD") returns Dcba.
  • (C) strcmp("abc", "bcd") returns a negative number
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose a correct C statement about String functions?

  • (A) strcmp("123","12345") returns a negative number
  • (B) toupper('a') returns A
  • (C) tolower('D') returns d.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. What is the output of C program?

Code:
int main()
{
    char str1[]="JAMES,";
    char str2[15]="BOND ";
    strcat(str2,str1);
    printf("%s",str2);
    printf("%s",str1);
}
  • (A) BOND JAMES,JAMES,
  • (B) JAMES BOND,JAMES,
  • (C) JAMES,JAMES,
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) BOND JAMES,JAMES,

Q. What is the output of C program?

Code:
int main()
{
    printf("%c","HUMPTY"[2]);
}
  • (A) U
  • (B) M
  • (C) HUMPTY
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) M

Q. What is the output of C program?

Code:
int main()
{
    char str1[] = "FIRST";
    char str2[20];
    strcpy(str2,str1);
    printf("%s %s ",str1,str2);
    printf("%d", (str1!=str2));
    printf("%d", strcmp(str1,str2));
    return 0;
}
  • (A) FIRST FIRST 0 1
  • (B) FIRST FIRST 1 0
  • (C) FIRST FIRST 1 1
  • (D) FIRST FIRST 0 0
πŸ’¬ Discuss
βœ… Correct Answer: (B) FIRST FIRST 1 0

Q. What is the output of C program with array of pointers to strings.?

Code:
int main()
{
    char *code[]={"IN","USA","K"};
    printf("%s", code[1]);
    return 0;
}
  • (A) U
  • (B) IN
  • (C) USA
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) USA

Q. What is the output of C program with String arrays?

Code:
int main()
{
    char code[3][4]={"IN","USA","K"};
    printf("%s", code[1]);
    return 0;
}
  • (A) K
  • (B) IN
  • (C) USA
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) USA

Q. What is the output of C program with array of pointers to strings?

Code:
int main()
{
    char *code[2];
    code[0]= (char *)malloc(4);
    strcpy(code[0], "IND");
    printf("%s", code[0]);
    return 0;
}
  • (A) I
  • (B) IN
  • (C) IND
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (C) IND

Q. What is actually passed to PRINTF or SCANF functions?

  • (A) Integer equivalent value of String
  • (B) End address of String
  • (C) Address of String
  • (D) Value of String
πŸ’¬ Discuss
βœ… Correct Answer: (C) Address of String