int f1 (int a, int b)
{
if (a > b)
{
printf("A is greater than B\n");
return 1;
}
else
{
printf("B is greater than A");
return 0;
}
}
main()
{
if (f1(20,10) || f1(10,20))
printf("C is fun!\n");
}
A is greater than B
C is fun!
A is greater than B
B is greater than A
C is fun!
A is greater than B
B is greater than A
Q3. What is the name for calling a function inside the same function?
Q6. Header files are listed using the preprocessing directive #include, and can have one of the following formats: #include <fileA> or #include "fileB". What is the difference between these two formats?
Q48. Which line of code, after execution, results in i having the value of 1?
Q49. What is the value of variable c at the end of this program?
1 main() {
2 int a, b, c;
3 a=10; b=50;
4 c=a * b % a;
5 }
Q50. What is not one of the basic data types in C
Q51. What is the member access operator for a structure?
Q52. What standard data type provides the smallest storage size and can be used in computations?
Q53. what does the ctype tolower() function do?
Q54. Void pointer vptr is assigned the address of float variable g. What is a valid way to dereference vptr to assign its pointed value to a float variable named f later in the program?
float g;
void *vptr=&g;
Q55. The dynamic memory allocation functions are defined in which system header file?
Q56. A function is a set of _.
Q57. How are static functions different from global functions?
Q58. Which code example creates the string "Hello Mars" in storage buffer hello.
Q62. What is not a valid type definition of a structure that contains x and y coordinates as integers, and that can be used as shown for the variable named point?
coord point;
point.x = 9;
point.y = 3;
struct coord{
int x;
int y;
};
typedef struct coord coord;
typedef struct coord{
int x;
int y;
};
typedef struct coord{
int x;
int y;
} coord;
typedef struct{
int x;
int y;
} coord;
Q63. What is the output of the below program?
Q64. What do the functions malloc() and calloc() allocate?
Q71. What is the correct output for the following code?
Q72. What is the Incorrect option that explains # pragma directive ?
Q73. What will be the output of the following code snippet?
Q74. What will be the output of the following code snippet?
Q75. What is the output of the following code snippet?
int main() {
int sum = 2 + 4 / 2 + 6 * 2;
printf("%d", sum);
return 0;
}
Q76. What does the following declaration mean?
int (*ptr)[10];
Q77. What will be the output of the following code snippet?
Q78. Choose true or false. When a variable is created in C, a memory address is assigned to the variable.
Q79. What does the following fragment of C-program print?
Q80. What is the output of the following code snippet?
int main() {
int a = 5, b = 6, c;
c = a++ + ++b;
printf("%d %d %d", a, b, c);
return 0;
}
Q81. What will be the output of the following C program segment?
char inchar = 'A';
switch (inchar)
{
case 'A' :
printf ("choice A \n") ;
case 'B' :
printf ("choice B ") ;
case 'C' :
case 'D' :
case 'E' :
default:
printf ("No Choice") ;
}
Q82. String variable str1 has the value of "abc", and string variable str2 has the value "xyz". What are the values of str1 and str2 after this statement is executed?
strcpy(str1, str2);
Q83. Which is not one of the basic data types in C?
Q84. You have written a function that you want to include as a member of structure a. How is such as structure member defined?
struct a {
void *f1;
};
struct a {
void (*f1)();
};
struct a {
*(void *f1)();
};
struct a {
void *f1();
};
Q85. You need to determine if a string variable is a substring of another string. Which standard C library function do you use?
Q86. How are static functions different from global functions?
Q87. What does this program display?
main(){
char *p = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
for (i=0;i<5;i++) *p++; *p++;
printf("%c",*p++);
}
Q88. What is not a valid command with this declaration?