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 Dynamic Initialization.

3 Answers  


The difference between printf and fprintf is ?

0 Answers   Baan Infotech,


write an algorithm to display a square matrix.

0 Answers  


C,c++, Java is all are structural oriented or procedure oriented language..?

6 Answers  


How can I convert integers to binary or hexadecimal?

2 Answers  






Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


what is the use of fflush() function?

2 Answers  


What do you mean by a local block?

0 Answers   InterGraph,


Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”

5 Answers   Mind Tree,


Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?

3 Answers   HCL, TCS,


What is data type long in c?

0 Answers  


Explain how can I prevent another program from modifying part of a file that I am modifying?

0 Answers  


Categories