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