-------------------------------------------------------------------------------------------------------------
Previous Page Next Page Last Page
-------------------------------------------------------------------------------------------------------------
11.
If the size of pointer is 4 bytes then What will be the output of the program ?
#include
int main()
{
char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
printf("%d, %d", sizeof(str), strlen(str[0]));
return 0;
}
A. 22, 4
B. 25, 5
C. 24, 5
D. 20, 2
Answer: C
---------------------------------------------------------------------------------------------------------------
12.
What will be the output of the program ?
#include
#include
int main()
{
char str1[5], str2[5];
int i;
gets(str1);
gets(str2);
i = strcmp(str1, str2);
printf("%d\n", i);
return 0;
}
A. Unpredictable integer value
B. 0
C. -1
D. Error
Answer: A
-------------------------------------------------------------------------------------------------------------
13.
What will be the output of the program ?
#include
int main()
{
char str = "ExecuteCodes";
printf("%s\n", str);
return 0;
}
A. Error
B. ExecuteCodes
C. Base address of str
D. No output
Answer: A
------------------------------------------------------------------------------------------------------------
14.
What will be the output of the program ?
#include
int main()
{
char str[] = "Nagpur";
str[0]='K';
printf("%s, ", str);
str = "Kanpur";
printf("%s", str+1);
return 0;
}
A. Kagpur, Kanpur
B. Nagpur, Kanpur
C. Kagpur, anpur
D. Error
Answer: D
-----------------------------------------------------------------------------------------------------------
Previous Page Next Page Last Page
-----------------------------------------------------------------------------------------------------------
More Imp Topics:
Array
Preprocessor
Structures
Control Structures
Switch Case
Printf
Variables
File Handling
Previous Page Next Page Last Page
-------------------------------------------------------------------------------------------------------------
11.
If the size of pointer is 4 bytes then What will be the output of the program ?
#include
int main()
{
char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"};
printf("%d, %d", sizeof(str), strlen(str[0]));
return 0;
}
A. 22, 4
B. 25, 5
C. 24, 5
D. 20, 2
Answer: C
---------------------------------------------------------------------------------------------------------------
12.
What will be the output of the program ?
#include
#include
int main()
{
char str1[5], str2[5];
int i;
gets(str1);
gets(str2);
i = strcmp(str1, str2);
printf("%d\n", i);
return 0;
}
A. Unpredictable integer value
B. 0
C. -1
D. Error
Answer: A
-------------------------------------------------------------------------------------------------------------
13.
What will be the output of the program ?
#include
int main()
{
char str = "ExecuteCodes";
printf("%s\n", str);
return 0;
}
A. Error
B. ExecuteCodes
C. Base address of str
D. No output
Answer: A
------------------------------------------------------------------------------------------------------------
14.
What will be the output of the program ?
#include
int main()
{
char str[] = "Nagpur";
str[0]='K';
printf("%s, ", str);
str = "Kanpur";
printf("%s", str+1);
return 0;
}
A. Kagpur, Kanpur
B. Nagpur, Kanpur
C. Kagpur, anpur
D. Error
Answer: D
-----------------------------------------------------------------------------------------------------------
Previous Page Next Page Last Page
-----------------------------------------------------------------------------------------------------------
More Imp Topics:
Array
Preprocessor
Structures
Control Structures
Switch Case
Printf
Variables
File Handling