What will the following code output? char str1[] = "world"; char str2[] =…

PYQ Hexaware Hiring Assessment 2024PYQ CoCubes 2024

What will the following code output?

char str1[] = "world";

char str2[] = "hello";

if(strcmp(str1, str2) > 0)

printf("str1 is greater");

else

printf("str2 is greater");

  1. A.

    str1 is greater

  2. B.

    str2 is greater

  3. C.

    Equal strings

  4. D.

    Compilation error

Attempted by 196 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…