C Practice Test on Strings

This “C Practice Test on Strings” providing set of technical and objective type questions on Strings to test your programming skills.


1. What is the Output of following Code?
#include<stdio.h>
void main()
{
char name[20] = “Hello” ;
printf(“%c”, name);
}

 
 
 
 

2. Which of the following function is more appropriate for reading in a multi-word string?

 
 
 
 

3. What is the Output of following Code?
void main()
{
char str[] = “Java\02Python”;
printf(“%s”, str);
}

 
 
 
 

4. What is the return type of strlen() function?

 
 
 
 

5. What is the Output of following Code?
#include<stdio.h>
void main()
{
char sport[]=”cricket”;
int x=1,y;
y=x++ + ++x;
printf(“%c”,sport[++y]);
}

 
 
 
 

6. What is the Output of following Code?
#include<stdio.h>
void main()
{
char s[ ]=”\0Clang”;
if(printf(“%s”,s))
printf(“TRUE”);
else
printf(“FALSE”);
}

 
 
 
 

7. What is the Output of following Code?
#include<stdio.h>
void main()
{
char s[10] = “CQuestions”;
printf(“%c”, 3[s]);
}

 
 
 
 

8. What is the Output of following Code?
#include<stdio.h>
void main()
{
int x ;
if(x=printf(“Hello\n”))
{
printf(“x : %d”,x);
}
}

 
 
 
 

9. What is the Output of following Code?
#include<stdio.h>
void main()
{
char *x=”HELLO”;
x+=2;
printf(“%s”,x++);
}

 
 
 
 

10. What is the Output of following Code?
#include<stdio.h>
void main()
{
char* str = “learnown”;
printf(“%c\n”,*((str– +2)+1)-3);
printf(“%c\n”, *(–str + 3)-32);
printf(“%c\n”,*(++str+2)+4);
}

 
 
 
 

Question 1 of 10

Share this