gs gs122 Recursion - Length of a String using Recursion - Quiz No.1
gs gs122 Data Communication and Computer Network Quiz
This quiz belongs to book/course code gs gs122 Data Communication and Computer Network of gs organization. We have 268 quizzes available related to the book/course Data Communication and Computer Network. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Recursion. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
#include<stdio.h> int get_len(char *s) { int len = 0; while(________) len++; return len; } int main() { char *s = "harsh"; int len = get_len(s); printf("%d",len); return 0; }
Which of the following lines should be inserted to complete the above code?
#include<stdio.h> int get_len(char *s) { int len = 0; while(s[len] != '\0') len++; return len; } int main() { char *s = ""; int len = get_len(s); printf("%d",len); return 0; }
#include<stdio.h> int recursive_get_len(char *s, int len) { if(s[len] == 0) return 0; return ________; } int main() { char *s = "abcdef"; int len = recursive_get_len(s,0); printf("%d",len); return 0; }
Which of the following lines should be inserted to complete the above code?