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