0
Alien head

Programming in C

Description: C
Number of Questions: 5
Created by:
Tags: C Looping Iteration Operators and Expression Strings and Character Arrays
Attempted 0/5 Correct 0 Score 0

What will be the result of the following expression in C?
x=strcmpi(&&ABC&&,&&abc&&);
printf(&&x=%d&&,x);

  1. x=1

  2. x=0

  3. x=2

  4. x=3

  5. none of these


Correct Option: B
Explanation:

This is the correct option as strcmpi() function ignores the case of arguments and returns 0, when two arguments are equal.

Which of the following character types of functions in C is used to verify whether inputted characters are in uppercase or not?

  1. toupper()

  2. isupper()

  3. tolower()

  4. isdigit()

  5. isalpha()


Correct Option: B
Explanation:

This character type of function in C is used to verify whether inputted characters are in uppercase or not.

What will be the output of the following C code?
void main()
{
int *ptr=&"&Chennai&"&;
printf(&"&%c&"&,++(ptr++));
}

  1. C

  2. d

  3. e

  4. a

  5. i


Correct Option: B
Explanation:

This is the correct option as the contents of pointer is incremented by 1 to store 'd'.

Which of the following string handling functions in C is used to reverse the characters in a string?

  1. strupr()

  2. strlen()

  3. strrev()

  4. strcpy()

  5. strcat()


Correct Option: C
Explanation:

This string handling function in C is used to reverse the characters in a string.

What will be the value of 'a' in the following C code?
int a=5;
printf(&"&a=%d&"&,a&2);

  1. a=5

  2. a=1

  3. a=2

  4. a=0

  5. a=3


Correct Option: D
Explanation:

This is the correct option as bitwise AND operator, when operated on binary 0101 and 0010 results in 0000.

+ View questions