August 29, 2016 0 Welcome to your Yippee Technology Online Aptitude Test on C language Name Nested unions are allowed True False Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+"); Writing Appending Read and Write Reading A pointer is, A variable that stores address of other variable All of the above A variable that stores address of an instruction A keyword used to create variables Which of the following statements correct about k used in the below statement? char ****k; k is a pointer to a pointer to a char k is a pointer to a char pointer k is a pointer to a pointer to a pointer to a char k is a pointer to a pointer to a pointer to a pointer to a char Which of the following function is used to find the first occurrence of a given string in another string? strrchr() strchr() strstr() strnset() Point out the compile time error in the program given below. #include<stdio.h> int main() { int *x; *x=100; return 0; } Error: invalid assignment for x Error: suspicious pointer conversion No error None of these By default a real number is treated as a double far double long double float Point out the error in the following program. #include<stdio.h> int main() { void v = 0; printf("%d", v); return 0; } Error: Declaration syntax error 'v' (or) Size of v is unknown or zero. None of these No error. Program terminates abnormally. only int and char data type is allowed in Union, Structures and Enums ? True False Functions can be called either by value or reference True False While() and do.... While() loop both are same ? True False what is the scope of variable X, if we declared it in small loop? Global Local Suppose a program is divided into three files f1, f2 and f3, and a variable is defined in the file f1 but used in files f2 and f3. In such a case would we need the extern declaration for the variables in the files f2 and f3? Yes No Is it true that too many recursive calls may result into stack overflow? No Yes How would you round off a value from 1.66 to 2.0? roundup(1.66) floor(1.66) roundto(1.66) ceil(1.66) If return type for a function is not specified, it defaults to int True False Input/output function prototypes and macros are defined in which header file? conio.h stdio.h dos.h stdlib.h Point out the error in the following program. #include<stdio.h> struct emp { char name[20]; int age; }; int main() { emp int xx; int a; printf("%d\n", &a); return 0; } None of these. No error. Error: in printf Error: in emp int xx; In the following code, the P2 is Integer Pointer or Integer? typedef int *ptr; ptr p1, p2; Integer Pointer Integer Error in declaration None of above A function cannot be defined inside the another function, but a function can be called inside a another function. False True What will be the output of the program ? #include<stdio.h> int main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); return 0; } 2, 1, 15 3, 2, 15 1, 2, 5 2, 3, 20 What will be the output of the program ? #include<stdio.h> int main() { int x=30, *y, *z; y=&x; /* Assume address of x is 500 and integer is 4 byte size */ z=y; *y++=*z++; x++; printf("x=%d, y=%d, z=%d\n", x, y, z); return 0; } x=31, y=498, z=498 x=31, y=502, z=502 x=31, y=500, z=500 x=31, y=504, z=504 Is it true ? A function cannot return more than one value at a time, because after returning a value the control is given back to calling function. No Yes How to get length of array a[20] ? a.length() strlen(a) a.strlen() None of these Which of the declaration is correct? int length; int long; float double; char int; which is true ? Maximum number of arguments that a function can take is 12 Maximum number of arguments that a function can take is 127 1 None of these 2 Will the following functions work? int f1(int a, int b) { return ( f2(20) ); } int f2(int a) { return (a*a); } No Yes Which of the following is not user defined data type? 1. struct book { char name[10]; float price; int pages; }; 2. long int l = 2.35; 3. enum day {Sun, Mon, Tue, Wed}; 2 1 Both 1 and 2 3 How will you print \n on the screen? Alert(''\n''); printf("\n"); echo "\\n"; printf("\\n"); What will be the output of the program? #include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; } 128 Error Garbage value The keyword used to transfer control from a function back to the calling function is goto switch return go back How to join following two strings in C language ? char str1[]="Hello" , str2[]=" Yippeetechnology.com" strconcat(str1,str2); strcat(str1,str2); None of these Printf(" "+str1+" "+str2); Point out the error in the following program #include<stdio.h> int main() { display(); return 0; } void display() { printf("YippeeTechnology.com"); } None of these No error display() is called before it is defined display() doesn't get invoked A float is 4 bytes wide, whereas a double is 8 bytes wide. False True Names of functions in two different files linked together must be unique False True Which of these is not correct about file handling in c ? fclose() : close a file a : opens a text file in append mode fopen() : create a new file or open a existing file r : opens a text file in both reading and writing mode The operator used to get value at address stored in a pointer variable is * || & $ What is the similarity between a structure, union and enumeration? All of them let you define new values All of them let you define new data types All of them let you define new pointers All of them let you define new structures Which of the following special symbol allowed in a variable name? * (asterisk) - (hyphen) | (pipeline) _ (underscore) Are the expression *ptr++ and ++*ptr are same? True False Time's up