a memory of 20 bytes is allocated to a string declared as
char *s then the following two statements are executed:
s="Etrance"
l=strlen(s);
what is the value of l ?
a.20
b.8
c.9
d.21

Answers were Sorted based on User's Feedback



a memory of 20 bytes is allocated to a string declared as char *s then the following two stateme..

Answer / fazlur rahaman naik

the string is Entrance or Etrance?
if it is Entrance,then only the answer is here.

b is the right answer.

because string length means it will count only the no.of
characters in that string only...not the null character.

Is This Answer Correct ?    23 Yes 1 No

a memory of 20 bytes is allocated to a string declared as char *s then the following two stateme..

Answer / subbu

l=7 is the right answer, which is not given in the options.

Is This Answer Correct ?    10 Yes 8 No

a memory of 20 bytes is allocated to a string declared as char *s then the following two stateme..

Answer / valli

20 bytes of memory is allocated to s
hence
l=strlen(s);//l=20
so answer is a

Is This Answer Correct ?    2 Yes 14 No

a memory of 20 bytes is allocated to a string declared as char *s then the following two stateme..

Answer / sivasankar.a

the answer is c)9 because of "etrance"this word lengh is 9.

Is This Answer Correct ?    3 Yes 19 No

Post New Answer

More C Interview Questions

What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

0 Answers  


implement general tree using link list

1 Answers   Wipro,


Write a C program to count the number of email on text

0 Answers  


What is ponter?

0 Answers   TCS,


write a c program for greatest of three numbers without using if statment

4 Answers   IBM,






In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

0 Answers  


How does C++ help with the tradeoff of safety vs. usability?

1 Answers  


#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?

3 Answers  


What is huge pointer in c?

0 Answers  


int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15

10 Answers   Wipro,


What are preprocessor directives in c?

0 Answers  


I have an array of 100 elements, each of which is a random integer. I want to know which of the elements: a) are multiples of 2 b) are multiples of 2 AND 5 c) have a remainder of 3 when divided by 7

1 Answers  


Categories