Mascot Previous Years Solved Sample Placement Papers
-
Which of the following function is used to find the first occurrence of a given string in another string?
A. strchr()
B. strrchr()
C. strstr()
D. strnset()
Ans: C -
What will be the output of the program in 16-bit platform (Turbo C under DOS)?
#include
int main() { printf(“%d, %d, %d”, sizeof(3.0f), sizeof(‘3’), sizeof(3.0)); return 0; } A. 8, 1, 4
B. 4, 2, 8
C. 4, 2, 4
D. 10, 3, 4
Ans: B -
Point out the error in the program?
#include
int main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0; i<=9; i++) scanf(“%s %f”, e[i].name, &e[i].sal); return 0; } A. Error: invalid structure member
B. Error: Floating point formats not linked
C. No error
D. None of above
Ans: B -
What will be the output of the program?
#include
int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT); return 0; } A. -1, 0, 1, 2, 3, 4
B. -1, 2, 6, 3, 4, 5
C. -1, 0, 6, 2, 3, 4
D. -1, 0, 6, 7, 8, 9
Ans: D -
What will be the output of the program?
#include
struct course { int courseno; char coursename[25]; }; int main() { struct course c[] = { {102, “Java”}, {103, “PHP”}, {104, “DotNet”} }; printf(“%d”, c[1].courseno); printf(“%s\n”, (*(c+2)).coursename); return 0; } A. 103 Dotnet
B. 102 Java
C. 103 PHP
D. 104 DotNet
Ans: A -
In which stage the following code gets replaced by the contents of the file stdio.h?
#include
A. During editing
B. During linking
C. During execution
D. During preprocessing
Ans: D -
Point out the error in the program
#include
int main() { int I; #if A printf(“Enter any number:”); scanf(“%d”, &i); #elif B printf(“The number is odd”); #endif return 0; } A. Error: unexpected end of file because there is no matching #endif
B. The number is odd
C. Garbage values
D. None of above
Ans: A