C Language - Strings

You Are Here :: Home > C Language > Strings - General Questions

 
13.

How many of the following string declarations are correct?

char string1 = "Hello";
char string2[] = "Hello";
char string3[5] = "Hello";
char string4[6] = {'H','e','l','l','o','\0'};

A. None B. One is correct
C. Two are correct D. Three are correct




14.

main()
{
char ch;
ch = getchar();
printf("Accepted Character : %c",ch);
}

A. Accepted Character : B. Accepted Character : A
C. Accepted Character : 0 D. Compiletime error




15.

#include< stdio.h>

#include< conio.h>
void main()
{
char string[] = "This is an example string\n";
puts(string); // String is variable Here
puts("String"); // String is in Double Quotes
getch();
}

A. String is : This is an example string B. String is : This is an example string
String
C. String is : This is an example string
String is : String
D. String is : This is an example string String




16.

#include
#include
void main()
{
char str[10];
printf("Enter the String : ");
scanf("%s",str); // Accept String
printf("String is : %s ",str);
getch();
}

A. Enter the String : shalu
shalu
B. Enter the String : shalu
String is : shalu
C. Enter the String :
String is : shalu
D. Enter the String : shalu shalu




17.

#include

int main()
{
char name[20];
printf("\nEnter the Name : ");
scanf("%s",name);
printf("Name of the Company : %s",name);
return(0);
}

A. Enter the Name : Google Incl Google B. Enter the Name : Google Incl
Google
C. Enter the Name :
Name of the Company : Google
D. Enter the Name : Google Incl
Name of the Company : Google




18.

num = atoi("1947");
printf("%d",num);

A. 1947 B. aidg
C. 0 D. Compiletime error




« previous

1

2

3

4

5

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on