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
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 |
Answer / subbu
l=7 is the right answer, which is not given in the options.
| Is This Answer Correct ? | 10 Yes | 8 No |
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 |
Answer / sivasankar.a
the answer is c)9 because of "etrance"this word lengh is 9.
| Is This Answer Correct ? | 3 Yes | 19 No |
What is the difference between int main and void main in c?
What is array of pointers to string?
Can we change the value of constant variable in c?
Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
A MobileNumber is a VIP number if it satisfy the following conditions. The operator should be Vodafone. Atleast one 0 (Zero) should be exist in mobile number. The number should not end with 8. The single digit sum of all the digits in the number should be equal to 9. For example if the number is 9876543210, the sum is 9+8+7+...+1+0 = 45. Sum of 4+5 = 9. Write a method: private boolean isVIPMobileNumber(String mobileNum, String operator) mobileNum phone number operator mobile operator as bsnl, Vodafone
What are global variables and explain how do you declare them?
Differentiate between a structure and a union.
What are data types in c language?
What are the 5 elements of structure?