Font size
WorksheetsCP midsem2 set3
Total questions: 31
Worksheet time: 32mins
(mandatory) Enter your details carefully :
Enter your 11 digit enrollment number:
Enter your class (DC1/DC2/DC3):
Enter your full name in following format (firstname lastname) ex. Pooja Raval
A structure can contain variables of int data types
A structure can contain variables of float data types
A structure can contain variables of char types
Predict the output: #include <stdio.h>
struct Point{
int x; int y;
};
int main() {
struct Point p;
p.x = 5; p.y = 10;
printf("(%d, %d)", p.x, p.y);
return 0;
}
What is the output of the following code?
#include <stdio.h>
int main() {
FILE *fp = fopen("example.txt", "w");
fprintf(fp, "Hello, World!");
fseek(fp, 0, SEEK_SET);
char str[20];
fgets(str, 20, fp);
printf("%s", str);
fclose(fp);
return 0;}
value of the 'num' variable
Value of the 'pointer' variable
Predict the output: #include <stdio.h> int main() { int num1 = 5, num2 = 10; int *ptr1 = &num1,
*ptr2 = &num2; *ptr1 = *ptr2; printf("%d", num1); return 0;}
What is the output of the following code? #include <stdio.h>
struct Point {
int x; int y;
};
int main() {
struct Point p = {3, 4};
printf("%d", p.x + p.y);
return 0;}
Predict the output: #include <stdio.h>
int main() {
int x = 5;
int ptr = &x;
printf("%d", *ptr);
return 0;
}
Which of the following is the correct way to declare a function in C?
int functionName;
functionName int()
int functionName()
functionName() int
Which of the following function declarations is correct?
int add(int a, b)
int add(int, int)
int add(int a, int b)
int add(a, b)
