[{"question":" Which Code sample will eventually cause the computer to run out of memory?","options":[{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\nwhile(1)\n{\n long *bigArray = (long *) malloc(sizeof(long) * 1000);\n memset(bigArray, 1000000, 1000);\n free(bigArray);\n}\n```"},{"question":" What will this code print on the screen?","options":[{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false},{"text":"Nothing is printed on Screen","correct":false}],"illustrator":"```\nA is greater then B\nB is greater then A\n```"},{"question":" What is the name for calling a function inside the same function?","options":[{"text":"recursion","correct":true},{"text":"subfunction","correct":false},{"text":"inner call","correct":false},{"text":"infinite loop","correct":false}],"illustrator":""},{"question":" What does the declaration of variable c2 demonstrate?","options":[{"text":"character arithmetic","correct":true},{"text":"undefined assignment","correct":false},{"text":"type conversion","correct":false},{"text":"invalid declaration","correct":false}],"illustrator":"```c\nmain(){\n char c1 ='a';\n char c2 = c1+10;\n}\n```"},{"question":" A pointer to void named vptr, has been set to point to a floating point variable named g. What is the valid way to dereference vptr to assign its pointed value to a float variable named f later in this program?","options":[{"text":"f = _(float _)vptr;","correct":false},{"text":"f = (float \\*)vptr;","correct":false},{"text":"f = \\*(float \\*)vptr;","correct":true},{"text":"f = \\*(float)vptr;","correct":false}],"illustrator":"```c\nfloat g;\nvoid *vptr=&g;\n```"},{"question":" What is this declaration an example of?","options":[{"text":"a node","correct":true},{"text":"a linked list","correct":false},{"text":"a stack","correct":false},{"text":"a binary tree","correct":false}],"illustrator":"```c\nstruct s {\n int i;\n struct s *s1;\n struct s *s2;\n};\n```"},{"question":" Header files are listed using the preprocessing directive #include, and can have one of the following formats: #include <fileA> or #include \"fileB\". What is the difference between these two formats?","options":[{"text":"The preprocessor will try to locate fileA in same directory as the source file, and the fileB in a predetermined directory path.","correct":false},{"text":"The preprocessor will try to locate fileA in the fixed system directory. It will try to locate fileB in the directory path designated by the -I option added to the command line while compiling the source code.","correct":false},{"text":"The file using the fileA syntax must be system files, of unlimited number; fileB must be a user file at a maximun of one per source file.","correct":false},{"text":"The preprocessor will try to locate fileA in a predetermined directory path. It will try to locate fileB in the same directory as the source file along with a custom directory path.","correct":true}],"illustrator":""},{"question":" Using a for loop, how could you write a C code to count down from 10 to 1 and display each number on its own line?","options":[{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":true}],"illustrator":"```c\nint i;\nfor (i= 10; i>0; i--){\n printf(\"%d\\n\", i);\n}// end of loop\n```"},{"question":" What is not one of the reserved words in standard C?","options":[{"text":"volatile","correct":false},{"text":"typeof","correct":true},{"text":"register","correct":false},{"text":"typedef","correct":false}],"illustrator":""},{"question":". What does the program shown below return?","options":[{"text":"1","correct":true},{"text":"3","correct":false},{"text":"2","correct":false},{"text":"0","correct":false}],"illustrator":"```c\nint main(){\n int a=1, b=2, c=3, d=4;\n int x = a;\n if (a>b)\n if (bname equivalent to?","options":[{"text":"`player.name`","correct":false},{"text":"`(\\*player).name`","correct":true},{"text":"`\\*player.name`","correct":false},{"text":"`player.\\*name`","correct":false}],"illustrator":""},{"question":". Which program will compile and run without errors?","options":[{"text":"","correct":false},{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\nmain() {\nint i;\n for (i= 10; i<10; i++)\n}\n```"},{"question":". What does this function call return?","options":[{"text":"2","correct":false},{"text":"2.000000","correct":false},{"text":"a runtime error","correct":false},{"text":"a compiler error","correct":true}],"illustrator":"```c\n1 main() { float x = f1(10, 5); }\n2 float f1(int a, int b) { return (a/b); }\n```"},{"question":". What does this program create?","options":[{"text":"a runtime error","correct":false},{"text":"a NULL pointer","correct":true},{"text":"a compile error","correct":false},{"text":"a void pointer","correct":false}],"illustrator":"```c\n#include \nint main() {\n int *p = NULL;\n return 0;\n}\n```"},{"question":". What is an alternative way to write the expression (\\*x).y?","options":[{"text":"There is no equivalent.","correct":false},{"text":"x->y","correct":true},{"text":"\\*x->y","correct":false},{"text":"y->x","correct":false}],"illustrator":""},{"question":". Compile time errors are static errors that can be found where in the code?","options":[{"text":"in declarations and definitions","correct":true},{"text":"in functions and expressions","correct":false},{"text":"in syntax and semantics","correct":false},{"text":"in objects and statements","correct":false}],"illustrator":""},{"question":". File input and output (I/O) in C is heavily based on the way it is done `___`?","options":[{"text":"in Unix","correct":true},{"text":"in C++","correct":false},{"text":"in C#","correct":false},{"text":"in DOS","correct":false}],"illustrator":""},{"question":". What does the strcmp(str1, str2); function return?","options":[{"text":"0 if str1 and str2 are the same, a negative number if str1 is less than str2, a positive number if str1 is greater than str2","correct":true},{"text":"true (1) if str1 and str2 are the same, false (0) if str1 and str2 are not the same","correct":false},{"text":"true (1) if str1 and str2 are the same, NULL if str1 and str2 are not the same","correct":false},{"text":"0 if str1 and str2 are the same, a negative number if str2 is less than str1, a positive number if str2 is greater than str1","correct":false}],"illustrator":""},{"question":". What is the output of this program?","options":[{"text":"100","correct":true},{"text":"200","correct":false},{"text":"5","correct":false},{"text":"50","correct":false}],"illustrator":"```c\nint a=10, b=20;\nint f1(a) { return(a*b); }\nmain() {\nprintf(\"%d\", f1(5));\n}\n```"},{"question":". Which is _not_ a correct way to declare a string variable?","options":[{"text":"`char *string = \"Hello World\";`","correct":false},{"text":"`char string = \"Hello World\";`","correct":true},{"text":"`char string[20] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'};`","correct":false},{"text":"`char string[] = \"Hello World\";`","correct":false}],"illustrator":""},{"question":". Which choice is an include guard for the header file mylib.h?","options":[{"text":"","correct":false},{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\n#ifdef MYLIB_H\n#define MYLIB_H\n// mylib.h content\n#endif /* MYLIB_H */\n```"},{"question":". How many times does the code inside the while loop get executed in this program?","options":[{"text":"100","correct":false},{"text":"3","correct":true},{"text":"5","correct":false},{"text":"50","correct":false}],"illustrator":"```c\nmain(){\n int x=1;\n while(x++<100){\n x*=x;\n if(x<10) continue;\n if(x>50) break\n }\n}\n```"},{"question":". File input and output (I/O) in C is done through what?","options":[{"text":"syntax-driven components","correct":false},{"text":"native interfaces","correct":false},{"text":"system objects","correct":false},{"text":"function calls","correct":true}],"illustrator":""},{"question":". Directives are translated by the?","options":[{"text":"Pre-processor","correct":true},{"text":"Compiler","correct":false},{"text":"Linker","correct":false},{"text":"Editor","correct":false}],"illustrator":""},{"question":". The main loop structures in C programming are the for loop, the while loop, and which other loop?","options":[{"text":"do...while","correct":true},{"text":"for...in","correct":false},{"text":"repeat...until","correct":false},{"text":"do...until","correct":false}],"illustrator":""},{"question":". By default, C Functions are what type of functions?","options":[{"text":"global","correct":false},{"text":"static","correct":false},{"text":"library","correct":true},{"text":"system","correct":false}],"illustrator":""},{"question":". You have written a function that you want to include as a member of structure a. How is such as structure member defiened?","options":[{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\nstruct a {\n void *f1();\n};\n```"},{"question":". A Stack data structure allows all data operations at one end only, making it what kind of an implementation?","options":[{"text":"FIFO","correct":false},{"text":"LIFO","correct":true},{"text":"LILO","correct":false},{"text":"LOLI","correct":false}],"illustrator":""},{"question":". What does this program display?","options":[{"text":"K","correct":false},{"text":"M","correct":false},{"text":"H","correct":false},{"text":"G","correct":true}],"illustrator":"```c\nmain(){\n char *p = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n int i;\n for (i=0;i<5;i++) *p++; *p++;\n printf(\"%c\",*p++);\n}\n```"},{"question":". Describe the relationship between lvalue and rvalue.","options":[{"text":"An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear only on the right-hand side.","correct":false},{"text":"An lvalue may appear only on the left-hand side of an assignment; an rvalue may appear on either the left-hand or right-hand side.","correct":false},{"text":"An lvaue and an rvalue may appear on either left-hand or right-hand side of an assignment.","correct":false},{"text":"An lvalue may appear on the left-hand or right-hand side of an assignment; an rvalue may appear only on the right-hand side.","correct":true}],"illustrator":""},{"question":". Which operator is used to access the address of a variable?","options":[{"text":"`%`","correct":false},{"text":"`**`","correct":false},{"text":"`*`","correct":false},{"text":"`&`","correct":true}],"illustrator":""},{"question":". Which add function properly returns the updated value of result?","options":[{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\nvoid add (int *a, int *b, int *result)\n{\n result = a+b;\n}\nmain()\n{\n int a = 10;\n int b = 20;\n int result = 0;\n add(*a,*b,*result);\n}\n```"},{"question":". Consider the number of the Fibonacci series below 100: 0,1,1,2,3,5,8,13,21,34,55,89. Which piece of code outputs the sequence?","options":[{"text":"","correct":false},{"text":"","correct":false},{"text":"","correct":true},{"text":"","correct":false}],"illustrator":"```c\nvoid fibonacci(int a, int b)\n{\n int c = a+b;\n if(a>100)\n return;\n printf(\"%d\", c);\n fibonacci(b,c);\n}\nint main()\n{\n fibonacci(0,1);\n}\n```"},{"question":". Which is _not_ a storage class specifier?","options":[{"text":"`intern`","correct":true},{"text":"`extern`","correct":false},{"text":"`register`","correct":false},{"text":"`static`","correct":false}],"illustrator":""},{"question":". Which line of code, after execution, results in `i` having the value of 1?","options":[{"text":"`for(i=1; i<=1; i++);`","correct":false},{"text":"`for(i=1; i=10; i++);`","correct":false},{"text":"`for(i=1; i==10; i++);`","correct":true},{"text":"`for(i=10; i>=1; i--);`","correct":false}],"illustrator":""},{"question":". What is the value of variable c at the end of this program?","options":[{"text":"50","correct":false},{"text":"5","correct":false},{"text":"0","correct":true},{"text":"500","correct":false}],"illustrator":"```\n1 main() {\n2 int a, b, c;\n3 a=10; b=50;\n4 c=a * b % a;\n5 }\n```"},{"question":". What is _not_ one of the basic data types in C","options":[{"text":"long double","correct":false},{"text":"unsigned char","correct":false},{"text":"array","correct":true},{"text":"float","correct":false}],"illustrator":""},{"question":". What is the member access operator for a structure?","options":[{"text":",","correct":false},{"text":"[]","correct":false},{"text":".","correct":true},{"text":":","correct":false}],"illustrator":""},{"question":". What standard data type provides the smallest storage size and can be used in computations?","options":[{"text":"char","correct":true},{"text":"float","correct":false},{"text":"int","correct":false},{"text":"short","correct":false}],"illustrator":""},{"question":". what does the ctype tolower() function do?","options":[{"text":"It returns TRUE for lowercase letters of the alphabet.","correct":false},{"text":"It ensures that text output uses only ASCII values (0 through 127).","correct":false},{"text":"It returns FALSE for lowercase letters of the alphabet.","correct":false},{"text":"It converts an uppercase letter of the alphabet to lowercase.","correct":true}],"illustrator":""},{"question":". Void pointer _vptr_ is assigned the address of float variable _g_. What is a valid way to dereference _vptr_ to assign its pointed value to a float variable named _f_ later in the program?","options":[{"text":"f=(float \\*)vptr;","correct":false},{"text":"f=\\*(float \\*)vptr;","correct":true},{"text":"f=\\*(float)vptr;","correct":false},{"text":"f=(float)\\*vptr;","correct":false}],"illustrator":"```c\nfloat g;\nvoid *vptr=&g;\n```"},{"question":". The dynamic memory allocation functions are defined in which system header file ?","options":[{"text":"stdio.h","correct":false},{"text":"stdlib.h","correct":true},{"text":"limits.h","correct":false},{"text":"stddef.h","correct":false}],"illustrator":""},{"question":". A function is a set of **\\_**.","options":[{"text":"declarations","correct":false},{"text":"statements","correct":true},{"text":"variables","correct":false},{"text":"objects","correct":false}],"illustrator":""},{"question":". How are static functions different from global functions?","options":[{"text":"Static functions must be declared in advance of being defined.","correct":false},{"text":"Static functions must be declared is a separate header file.","correct":false},{"text":"Static functions always return the same value.","correct":false},{"text":"Static functions can be accessed only in the file where they are declared.","correct":true}],"illustrator":""},{"question":". Which code example creates the string \"Hello Mars\" in storage buffer `hello`.","options":[{"text":"","correct":false},{"text":"","correct":true},{"text":"","correct":false},{"text":"","correct":false}],"illustrator":"```c\n char hello[25];\n strcpy(hello, \"Hello World\");\n strcpy(*hello[6], \"Mars\");\n```"},{"question":". If you use the fopen() function with the \"a\" mode, what happens if the named file doesn't exist?","options":[{"text":"The file is created and opened for reading.","correct":false},{"text":"The file is created and opened for writing.","correct":false},{"text":"The fopen() function returns a NULL indicating that the operation has failed.","correct":false},{"text":"The file is created and opened for both writing and reading","correct":false}],"illustrator":""}]