Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: String

Home > C Programming > String > General Questions

11. What is the output of the following 'C' program ?

#include
int main()
{
char arr[] = "Its very beautiful";
char *ptr = "Hello world";
char *str = "Sieze the day";
ptr = &arr[0];
printf("%s\n", ptr);
ptr = &str[0];
printf("%s\n", ptr);
}

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option A

Explanation:

In recursion, a stack frame gets created, and for each function call, an entry is created in the stack frame, which is also known as Active record instance. Each of the entries into the stack gets executed in a LIFO manner because a stack always executes in a LIFO manner i.e, last in first out. 

Workspace


Tags:  No Tags on this question yet!

13. What is the output of the program?

#include
#include
void main ()
{
char str[][5] = {{'h','e','l','l'}, {'w','e','l','l'}};
printf("\n %s ", strncpy (*str, *(str + 1), 0));
}

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Commvault

14. What is the output of the program?

#include
#include

void main () {
char str[][5] = {{'h','e','l','l'}, {'w','e','l','l'}};
char str1[15] = "All is ";
printf ("%s ", strcat(strchr(str1, 'l'), *(str+1)));
}

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Commvault

15. Predict the output or error(s) for the following:

void main()
{
char string[]="Hello World";
display (string);
}
void display (char *string)
{
printf("%s",string);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Wipro

16. In a compiler there is 36 bit for a word and to store a character 8 bits are needed. IN this to store a character two words are appended .Then for storing a K characters string, How many words are needed.

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Wipro

17. What will be output of the following "c" code?

#include
void main()
{
char s[]="main";
int i;
for(i=0; s[i]; i++)
printf("%c %c %c %c", s[i], *(s+i), *(i+s),i[s]);
}

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

18. Predict the output or error(s) for the following:

main(){
char string[]="HelloWorld";
display (string);
}
void display (char *string){
printf("%s",string);
}

Answer: Option D

Explanation:

Compiler Error: Type mismatch in re declaration of function display

Workspace


Tags:  Wipro

19. What will be the result of the following program?

#include
int main(){
char p[]="String";
int x;
if(p=="String"){
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
return 0;
}

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  TCS

20. What will be the result of the following program?

#include
#include
char *gxxx(){
static char xxx[1024];
return xxx;
}
int main(){
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is : %s",gxxx());
return 0;
}

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  TCS



Most Popular Qs.

Latest MCQ Qs.