C - Strings

page 1 out of 6

page 1 out of 6


Question 1     

What is the output of the below code

#include<stdio.h>
int main()
{
      char str[]="C-program";
      int a = 5;
      printf(a >10?"Ps\n":"%s\n", str);
      return 0;
}





Question 2     

What is the last character of the string in C ?







Question 4     

a) char *name = “Theinquisitive”;
b) char name[] = “ Theinquisitive”;
can we apply all the string operations to both a and b declarations?
 




Question 5     

What is the expected output for the below code snippet?

#include <stdio.h>

int main() {
    printf(“ ‘\0’ ” );
    return 0;
}
  





Question 6     

What is the expected output for the below code snippet?

#include<stdio.h>
  
int main()
{    
    
    char name[5] = "Theinquisitive";
    
    printf("%s",name);
      
    return 0;
}







Question 7     

What is the expected output for the below code snippet?

#include<stdio.h>
  
int main()
{    
    
    char name[5];
    
    scanf("%s",name);
    
    printf("%s",name);
      
    return 0;
}

if we pass the argument as “The Inquisitive”






Question 8     

Which of the following is a best to take strings as a input?






Question 9     

printf() and puts() both will take the multi-word strings




Question 10     

What is the expected output for the below code snippet?

#include<stdio.h>
  
int main()
{    
    
    char name[50];
    
    scanf("%[^\n]s",name);
    
    printf("%s",name);
      
    return 0;
}
if we pass the argument as “The Inquisitive tag line is Knowledge is Boundless \n”




page 1 out of 6

page 1 out of 6


Sign Up Page

Oops!!

To view the solution need to Login



Score : 0 / 0
L
o
a
d
i
n
g
.
.
.