Question 3473 – Mathematical-Reasoning
May 25, 2024
NTA UGC NET Dec 2023 Paper-2
May 26, 2024
Question 3473 – Mathematical-Reasoning
May 25, 2024
NTA UGC NET Dec 2023 Paper-2
May 26, 2024

Question 4908 – UGC NET CS 2018-DEC Paper-2

Consider the C/C++ function f() given below:
void f(char w [ ] )
{
int x = strlen(w); //length of a string
char c;
For (int i = 0; i < x; i++)
{
c = w[i];
w[i] = w[x – i – 1];
w[x – i – 1] = c;
}
}
Which of the following is the purpose of f() ?

Correct Answer: C

Question 41 Explanation: 
It outputs the contents of the array in the original order because it swaps pairs of elements at locations (i and x – i – 1) twice .
A
It output the content of the array with the characters rearranged so they are no longer recognized a the words in the original phrase.
B
It output the contents of the array with the characters shifted over by one position.
C
It outputs the contents of the array in the original order.
D
It outputs the contents of the array in the reverse order.

Leave a Reply

Your email address will not be published. Required fields are marked *