Top

Strings

Answer: B

The mem functions is used for manipulating objects as character arrays.

Enter details here

52.

What will be the output of the program ?

#include

int main()
{
    static char s[25] = "The cocaine man";
    int i=0;
    char ch;
    ch = s[++i];
    printf("%c", ch);
    ch = s[i++];
    printf("%c", ch);
    ch = i++[s];
    printf("%c", ch);
    ch = ++i[s];
    printf("%c", ch);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

53.

Output of following program

#include  
int fun(char *p) 
{ 
    if (p == NULL || *p == '\0') return 0; 
    int current = 1, i = 1; 
    while (*(p+current)) 
    { 
        if (p[current] != p[current-1]) 
        { 
            p[i] = p[current]; 
            i++; 
        } 
        current++; 
    } 
    *(p+i)='\0'; 
    return i; 
} 
  
int main() 
{ 
    char str[] = "geeksskeeg"; 
    fun(str); 
    puts(str); 
    return 0; 
} 

 

Answer: A

No answer description available for this question.
 

Enter details here

54.

What does the following function returns void *memmove(void *s1,const void s2, size_t n);?

Answer: A

The memmove() function copies n characters from the object pointed to by s2 into the object pointed to by s1.The memmove() function returns the value of s1.

Enter details here

Answer: A

This function returns the length of the transformed string, not including the terminating null character.

Enter details here

56.

Which among the given options compares atmost n characters of string ch to string s?

Answer: A

int strncmp(ch, s, n) is used to compare at most n characters of string ch to string s; return <0>s.

Enter details here

57.

What will be the output of the program ?

#include

int main()
{
    char str = "IndiaBIX";
    printf("%s\n", str);
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

58.

What will be the output of the program ?

#include
void swap(char *, char *);

int main()
{
    char *pstr[2] = {"Hello", "IndiaBIX"};
    swap(pstr[0], pstr[1]);
    printf("%s\n%s", pstr[0], pstr[1]);
    return 0;
}
void swap(char *t1, char *t2)
{
    char *t;
    t=t1;
    t1=t2;
    t2=t;
}

 

Answer: C

No answer description available for this question.

Enter details here

59.

What will be the output of the program in 16-bit platform (Turbo C under DOS) ?

#include

int main()
{
    printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));
    return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

60.

What is the output of following program?

#include 
void swap(char *str1, char *str2) 
{ 
  char *temp = str1; 
  str1 = str2; 
  str2 = temp; 
}   
    
int main() 
{ 
  char *str1 = "Geeks"; 
  char *str2 = "Quiz"; 
  swap(str1, str2); 
  printf("str1 is %s, str2 is %s", str1, str2); 
  return 0; 
} 

 

Answer: B

No answer description available for this question.
 

Enter details here

Loading…
Tags: Strings Questions and Answers || Strings MCQ Questions and Answers || Strings GK Questions and Answers || Strings GK MCQ Questions || Strings Multiple Choice Questions and Answers || Strings GK || GK on Strings || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming