int f1 (int a, int b)
{
if (a > b)
{
printf("A is greater than B\n");
return 1;
}
else
{
printf("B is greater than A");
return 0;
}
}
main()
{
if (f1(20,10) || f1(10,20))
printf("C is fun!\n");
}
[x] :
A is greater then B
C is fun!
[ ] :
A is greater then B
B is greater then A
C is fun!
[ ] :
A is greater then B
B is greater then A
[ ] Nothing is printed on Screen
Q3. What is the name for calling a function inside the same function?
[x] recursion
[ ] subfunction
[ ] inner call
[ ] infinite loop
Q4. What does the declaration of variable c2 demonstrate?
main(){
char c1 ='a';
char c2 = c1+10;
}
[x] character arithmetic
[ ] undefined assignment
[ ] type conversion
[ ] invalid declaration
Q5. What is this declaration an example of?
struct s {
int i;
struct s *s1;
struct s *s2;
};
[x] a node
[ ] a linked list
[ ] a stack
[ ] a binary tree
Q6. 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?
[ ] The preprocessor will try to locate fileA in same directory as the source file, and the fileB in a predetermined directory path.
[ ] 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.
[ ] 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.
[x] 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.
Q7. 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?
[ ] :
for (int i = 0; i>=0, i--){
printf("%d\n", i);
}//end of loop
[ ] :
int i;
for (i=1; i<=10; i++){
printf("%d", i);
}
[ ] :
int i = 10;
while (i>0){
printf("%d\n", i);
i--;
}
[x] :
int i;
for (i= 10; i>0; i--){
printf("%d\n", i);
}// end of loop
Q8. What is not one of the reserved words in standard C?
Q48. Which line of code, after execution, results in i having the value of 1?
[ ] for(i=1; i<=1; i++);
[ ] for(i=1; i=10; i++);
[x] for(i=1; i==10; i++);
[ ] for(i=10; i>=1; i--);
Q49. What is the value of variable c at the end of this program?
1 main() {
2 int a, b, c;
3 a=10; b=50;
4 c=a * b % a;
5 }
[ ] 50
[ ] 5
[x] 0
[ ] 500
Q50. What is not one of the basic data types in C
[ ] long double
[ ] unsigned char
[x] array
[ ] float
Q51. What is the member access operator for a structure?
[ ] ,
[ ] []
[x] .
[ ] :
Q52. What standard data type provides the smallest storage size and can be used in computations?
[x] char
[ ] float
[ ] int
[ ] short
Q53. what does the ctype tolower() function do?
[ ] It returns TRUE for lowercase letters of the alphabet.
[ ] It ensures that text output uses only ASCII values (0 through 127).
[ ] It returns FALSE for lowercase letters of the alphabet.
[x] It converts an uppercase letter of the alphabet to lowercase.
Q54. 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?
float g;
void *vptr=&g;
[ ] f=(float *)vptr;
[x] f=*(float *)vptr;
[ ] f=*(float)vptr;
[ ] f=(float)*vptr;
Q55. The dynamic memory allocation functions are defined in which system header file ?
[ ] stdio.h
[x] stdlib.h
[ ] limits.h
[ ] stddef.h
Q56. A function is a set of _.
[ ] declarations
[x] statements
[ ] variables
[ ] objects
Q57. How are static functions different from global functions?
[ ] Static functions must be declared in advance of being defined.
[ ] Static functions must be declared is a separate header file.
[ ] Static functions always return the same value.
[x] Static functions can be accessed only in the file where they are declared.
Q58. Which code example creates the string “Hello Mars” in storage buffer hello.
[ ] the smaller value of the two passed parameters
[ ] runtime error
[x] the greater value of the two passed parameters
Q61. Which function fo you use to deallocate memory?
[x] free()
[ ] dealloc()
[ ] release()
[ ] dealloc()
Q62. Which option is a valid function name?
[x] draw_star()
[ ] 5times()
[ ] upper-limit()
[ ] auto()
Q63. What is not a valid type definition of a structure that contains x and y coordinates as integers, and that can be used as shown for the variable named point?
coord point;
point.x = 9;
point.y = 3;
[ ] :
struct coord{
int x;
int y;
};
typedef struct coord coord;
Please Comment for your required Exam Answers and we will try to provide you at shortest time. We truly value your contribution to the website. Thank you!!!