Get Latest Exam Updates, Free Study materials and Tips

Exit Intent

[MCQ] C Programming

Module 1.1

1. C99 standard guarantees uniqueness of __________ characters for internal names.
a) 31
b) 63
c) 12
d) 14
Answer: b
Explanation: ISO C99 compiler may consider only first 63 characters for internal names.

2. C99 standard guarantees uniqueness of ___________ characters for external names.
a) 31
b) 6
c) 12
d) 14
Answer: a
Explanation: ISO C99 compiler may consider only first 31 characters for external names.

3. Which of the following is not a valid variable name declaration?
a) int __a3;
b) int __3a;
c) int __A3;
d) None of the mentioned
Answer: d
Explanation: None.

4. Which of the following is not a valid variable name declaration?
a) int _a3;
b) int a_3;
c) int 3_a;
d) int _3a
Answer: c
Explanation: Variable name cannot start with a digit.

5. Why do variable names beginning with the underscore is not encouraged?
a) It is not standardized
b) To avoid conflicts since assemblers and loaders use such names
c) To avoid conflicts since library routines use such names
d) To avoid conflicts with environment variables of an operating system
Answer: c
Explanation: None.

6. All keywords in C are in ____________
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned
Answer: a
Explanation: None.

7. Variable name resolution (number of significant characters for the uniqueness of variable) depends on ___________
a) Compiler and linker implementations
b) Assemblers and loaders implementations
c) C language
d) None of the mentioned
Answer: a
Explanation: It depends on the standard to which compiler and linkers are adhering.

8. Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
Answer: d
Explanation: Since only underscore and no other special character is allowed in a variable name, it results in an error.

9. Which of the following is true for variable names in C?
a) They can contain alphanumeric characters as well as special characters
b) It is not an error to declare a variable to be one of the keywords(like goto, static)
c) Variable names cannot start with a digit
d) Variable can be of any length
Answer: c
Explanation: According to the syntax for C variable name, it cannot start with a digit.

10. Which is valid C expression?
a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;
Answer: b
Explanation: Space, comma and $ cannot be used in a variable name.

11. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“Hello World! %d \n”, x);
return 0;
}
a) Hello World! x;
b) Hello World! followed by a junk value
c) Compile time error
d) Hello World!
Answer: c
Explanation: It results in an error since x is used without declaring the variable x.
Output:
$ cc pgm1.c
pgm1.c: In function ‘main’:
pgm1.c:4: error: ‘x’ undeclared (first use in this function)
pgm1.c:4: error: (Each undeclared identifier is reported only once
pgm1.c:4: error: for each function it appears in.)

12. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf(“Hello World! %d\n”, y);
return 0;
}
a) Compile time error
b) Hello World! 34
c) Hello World! 1000
d) Hello World! followed by a junk value
Answer: a
Explanation: Since y is already defined, redefining it results in an error.
Output:
$ cc pgm2.c
pgm2.c: In function ‘main’:
pgm2.c:5: error: redefinition of ‘y’
pgm2.c:4: note: previous definition of ‘y’ was here

13. Which of the following is not a valid variable name declaration?
a) float PI = 3.14;
b) double PI = 3.14;
c) int PI = 3.14;
d) #define PI 3.14
Answer: d
Explanation: #define PI 3.14 is a macro preprocessor, it is a textual substitution.

14. What will happen if the following C code is executed?

#include <stdio.h>
int main()
{
int main = 3;
printf(“%d”, main);
return 0;
}
a) It will cause a compile-time error
b) It will cause a run-time error
c) It will run without any error and prints 3
d) It will experience infinite looping
Answer: c
Explanation: A C program can have same function name and same variable name.
$ cc pgm3.c
$ a.out
3

15. What is the problem in the following variable declaration?
float 3Bedroom-Hall-Kitchen?;
a) The variable name begins with an integer
b) The special character ‘-‘
c) The special character ‘?’
d) All of the mentioned
Answer: d
Explanation: A variable name cannot start with an integer, along with that the C compiler interprets the ‘-‘ and ‘?’ as a minus operator and a question mark operator respectively.

16. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ThisIsVariableName = 12;
int ThisIsVariablename = 14;
printf(“%d”, ThisIsVariablename);
return 0;
}
a) The program will print 12
b) The program will print 14
c) The program will have a runtime error
d) The program will cause a compile-time error due to redeclaration
Answer: b
Explanation: Variable names ThisIsVariablename and ThisIsVariableName are both distinct as C is case sensitive.
Output:
$ cc pgm4.c
$ a.out
14

17. Which of the following cannot be a variable name in C?
a) volatile
b) true
c) friend
d) export
Answer: a
Explanation: volatile is C keyword.

18. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == ‘5’)
printf(“%d\n”, a[i]);
else
printf(“FAIL\n”);
}
a) The compiler will flag an error
b) The program will compile and print the output 5
c) The program will compile and print the ASCII value of 5
d) The program will compile and print FAIL for 5 times
Answer: d
Explanation: The ASCII value of 5 is 53, the char type-casted integral value 5 is 5 only.
Output:
$ cc pgm1.c
$ a.out
FAIL
FAIL
FAIL
FAIL
FAIL

19. The format identifier ‘%i’ is also used for _____ data type.
a) char
b) int
c) float
d) double
Answer: b
Explanation: Both %d and %i can be used as a format identifier for int data type.

20. Which data type is most suitable for storing a number 65000 in a 32-bit system?
a) signed short
b) unsigned short
c) long
d) int
Answer: b
Explanation: 65000 comes in the range of short (16-bit) which occupies the least memory. Signed short ranges from -32768 to 32767 and hence we should use unsigned short.

21. Which of the following is a User-defined data type?
a) typedef int Boolean;
b) typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
c) struct {char name[10], int age};
d) all of the mentioned
Answer: d
Explanation: typedef and struct are used to define user-defined data types.

22. What is the size of an int data type?
a) 4 Bytes
b) 8 Bytes
c) Depends on the system/compiler
d) Cannot be determined
Answer: c
Explanation: The size of the data types depend on the system.

23. What will be the output of the following C code?

#include <stdio.h>
int main()
{
signed char chr;
chr = 128;
printf(“%d\n”, chr);
return 0;
}
a) 128
b) -128
c) Depends on the compiler
d) None of the mentioned
Answer: b
Explanation: signed char will be a negative number.
Output:
$ cc pgm2.c
$ a.out
-128

24. What will be the output of the following C code?

#include <stdio.h>
int main()
{
char c;
int i = 0;
FILE *file;
file = fopen(“test.txt”, “w+”);
fprintf(file, “%c”, ‘a’);
fprintf(file, “%c”, -1);
fprintf(file, “%c”, ‘b’);
fclose(file);
file = fopen(“test.txt”, “r”);
while ((c = fgetc(file)) != -1)
printf(“%c”, c);
return 0;
}
a) a
b) Infinite loop
c) Depends on what fgetc returns
d) Depends on the compiler
Answer: a
Explanation: None.
Output:
$ cc pgm3.c
$ a.out
a

25. What is short int in C programming?
a) The basic data type of C
b) Qualifier
c) Short is the qualifier and int is the basic data type
d) All of the mentioned
Answer: c
Explanation: None.

26. What will be the output of the following C code?

#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf(“equal\n”);
else
printf(“not equal\n”);
}
a) equal
b) not equal
c) output depends on the compiler
d) error
Answer: b
Explanation: 0.1 by default is of type double which has different representation than float resulting in inequality even after conversion.
Output:
$ cc pgm4.c
$ a.out
not equal

27. What will be the output of the following C code?

#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1f)
printf(“equal\n”);
else
printf(“not equal\n”);
}
a) equal
b) not equal
c) output depends on compiler
d) error
Answer: a
Explanation: 0.1f results in 0.1 to be stored in floating point representations.
Output:
$ cc pgm5.c
$ a.out
equal

28. What will be the output of the following C code on a 32-bit machine?

#include <stdio.h>
int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf(“p and q are %d and %d”, sizeof(p), sizeof(q));
return 0;
}
a) p and q are 4 and 4
b) p and q are 4 and 8
c) compiler error
d) p and q are 2 and 8
Answer: a
Explanation: Size of any type of pointer is 4 on a 32-bit machine.
Output:
$ cc pgm6.c
$ a.out
p and q are 4 and 4

29. Which is correct with respect to the size of the data types?
a) char > int > float
b) int > char > float
c) char < int < double
d) double > char > int
Answer: c
Explanation: char has less bytes than int and int has less bytes than double in any system

30. What will be the output of the following C code on a 64 bit machine?

#include <stdio.h>
union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf(“%d”, sizeof(s));
return 0;
}
a) 8
b) 5
c) 9
d) 4
Answer: d
Explanation: Since the size of a union is the size of its maximum data type, here int is the largest data type. Hence the size of the union is 4.
Output:
$ cc pgm7.c
$ a.out
4

31. What will be the output of the following C code?

#include <stdio.h>
int main()
{
float x = ‘a’;
printf(“%f”, x);
return 0;
}
a) a
b) run time error
c) a.0000000
d) 97.000000
Answer: d
Explanation: Since the ASCII value of a is 97, the same is assigned to the float variable and printed.
Output:
$ cc pgm8.c
$ a.out
97.000000

32. Which of the data types has the size that is variable?
a) int
b) struct
c) float
d) double
Answer: b
Explanation: Since the size of the structure depends on its fields, it has a variable size.

33. What will be the output of the following C code?

#include <stdio.h>
int main()
{
enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
printf(“PEACH = %d\n”, PEACH);
}
a) PEACH = 3
b) PEACH = 4
c) PEACH = 5
d) PEACH = 6
Answer: c
Explanation: In enum, the value of constant is defined to the recent assignment from left.
Output:
$ cc pgm1.c
$ a.out
PEACH = 5

34. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“C programming %s”, “Class by\n%s Sanfoundry”, “WOW”);
}
a)

C programming Class by
WOW Sanfoundry
b) C programming Class by\n%s Sanfoundry
c)

C programming Class by
%s Sanfoundry

d) Compilation error
Answer: c
Explanation: This program has only one %s within first double quotes, so it does not read the string “WOW”.
The %s along with the Sanfoundry is not read as a format modifier while new line character prints the new line.
Output:
$ cc pgm2.c
$ a.out
C programming Class by
%s Sanfoundry

35. In the following code snippet, character pointer str holds a reference to the string ___________

char *str = “Sanfoundry.com\0” “training classes”;
a) Sanfoundry.com
b) Sanfoundry.com\0training classes
c) Sanfoundry.comtraining classes
d) Invalid declaration
Answer: b
Explanation: ‘\0’ is accepted as a char in the string. Even though strlen will give length of string “Sanfoundry.com”, in memory str is pointing to entire string including training classes.

36. What will be the output of the following C code?

#include <stdio.h>
#define a 10
int main()
{
const int a = 5;
printf(“a = %d\n”, a);
}
a) a = 5
b) a = 10
c) Compilation error
d) Runtime error
Answer: c
Explanation: The #define substitutes a with 10 without leaving any identifier, which results in Compilation error.
Output:
$ cc pgm3.c
pgm3.c: In function ‘main’:
pgm3.c:5: error: expected identifier or ‘(’ before numeric constant

37. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int var = 010;
printf(“%d”, var);
}
a) 2
b) 8
c) 9
d) 10
Answer: b
Explanation: 010 is octal representation of 8.
Output:
$ cc pgm4.c
$ a.out
8

38. What will be the output of the following C function?

#include <stdio.h>
enum birds {SPARROW, PEACOCK, PARROT};
enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
int main()
{
enum birds m = TIGER;
int k;
k = m;
printf(“%d\n”, k);
return 0;
}
a) 0
b) Compile time error
c) 1
d) 8
Answer: d
Explanation: m is an integer constant, hence it is compatible.
Output:
$ cc pgm5.c
$ a.out
8

39. What will be the output of the following C code?

#include <stdio.h>
#define MAX 2
enum bird {SPARROW = MAX + 1, PARROT = SPARROW + MAX};
int main()
{
enum bird b = PARROT;
printf(“%d\n”, b);
return 0;
}
a) Compilation error
b) 5
c) Undefined value
d) 2
Answer: b
Explanation: MAX value is 2 and hence PARROT will have value 3 + 2.
Output:
$ cc pgm6.c
$ a.out
5

40. What will be the output of the following C code?

#include <stdio.h>
#include <string.h>
int main()
{
char *str = “x”;
char c = ‘x’;
char ary[1];
ary[0] = c;
printf(“%d %d”, strlen(str), strlen(ary));
return 0;
}
a) 1 1
b) 2 1
c) 2 2
d) 1 (undefined value)
Answer: d
Explanation: str is null terminated, but ary is not null terminated.
Output:
$ cc pgm7.c
$ a.out
1 5

41. enum types are processed by _________
a) Compiler
b) Preprocessor
c) Linker
d) Assembler
Answer: a
Explanation: None.

42. What will be the output of the following C code?

#include <stdio.h>
int main()
{
const int p;
p = 4;
printf(“p is %d”, p);
return 0;
}
a) p is 4
b) Compile time error
c) Run time error
d) p is followed by a garbage value
Answer: b
Explanation: Since the constant variable has to be declared and defined at the same time, not doing it results in an error.
Output:
$ cc pgm10.c
pgm10.c: In function ‘main’:
pgm10.c:5: error: assignment of read-only variable ‘p’

43. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 4;
int *const p = &k;
int r = 3;
p = &r;
printf(“%d”, p);
}
a) Address of k
b) Address of r
c) Compile time error
d) Address of k + address of r
Answer: c
Explanation: Since the pointer p is declared to be constant, trying to assign it with a new value results in an error.
Output:
$ cc pgm11.c
pgm11.c: In function ‘main’:
pgm11.c:7: error: assignment of read-only variable ‘p’
pgm11.c:8: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int * const’

44. Which of the following statement is false?
a) Constant variables need not be defined as they are declared and can be defined later
b) Global constant variables are initialized to zero
c) const keyword is used to define constant values
d) You cannot reassign a value to a constant variable
Answer: a
Explanation: Since the constant variable has to be declared and defined at the same time, not doing it results in an error.

45. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int const k = 5;
k++;
printf(“k is %d”, k);
}
a) k is 6
b) Error due to const succeeding int
c) Error, because a constant variable can be changed only twice
d) Error, because a constant variable cannot be changed
Answer: d
Explanation: Constant variable has to be declared and defined at the same time. Trying to change it results in an error.
Output:
$ cc pgm12.c
pgm12.c: In function ‘main’:
pgm12.c:5: error: increment of read-only variable ‘k’

Module 1.2

1. What will be the output of the following C function?

#include <stdio.h>
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
exit(0);
printf(“%d\n”, i);
return reverse(i++);
}
a) 1 2 3 4 5
b) 1 2 3 4
c) Compile time error
d) Stack overflow
Answer: d
Explanation: None.

2. What will be the output of the following C function?

#include <stdio.h>
void reverse(int i);
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
return ;
printf(“%d “, i);
return reverse((i++, i));
}
a) 1 2 3 4 5
b) Segmentation fault
c) Compilation error
d) Undefined behaviour
Answer: a
Explanation: None.

3. In expression i = g() + f(), first function called depends on __________
a) Compiler
b) Associativiy of () operator
c) Precedence of () and + operator
d) Left to write of the expression
Answer: a
Explanation: None.

4. What will be the final values of i and j in the following C code?

#include <stdio.h>
int x = 0;
int main()
{
int i = (f() + g()) || g();
int j = g() || (f() + g());
}
int f()
{
if (x == 0)
return x + 1;
else
return x – 1;
}
int g()
{
return x++;
}
a) i value is 1 and j value is 1
b) i value is 0 and j value is 0
c) i value is 1 and j value is undefined
d) i and j value are undefined
Answer: d
Explanation: None.

5. What will be the final values of i and j in the following C code?

#include <stdio.h>
int x = 0;
int main()
{
int i = (f() + g()) | g(); //bitwise or
int j = g() | (f() + g()); //bitwise or
}
int f()
{
if (x == 0)
return x + 1;
else
return x – 1;
}
int g()
{
return x++;
}
a) i value is 1 and j value is 1
b) i value is 0 and j value is 0
c) i value is 1 and j value is undefined
d) i and j value are undefined
Answer: c
Explanation: None.

6. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = y && (y |= 10);
printf(“%d\n”, z);
return 0;
}
a) 1
b) 0
c) Undefined behaviour due to order of evaluation
d) 2
Answer: b
Explanation: None.

7. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = (y++) ? 2 : y == 1 && x;
printf(“%d\n”, z);
return 0;
}
a) 0
b) 1
c) 2
d) Undefined behaviour
Answer: b
Explanation: None.

8. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z;
z = (y++, y);
printf(“%d\n”, z);
return 0;
}
a) 0
b) 1
c) Undefined behaviour
d) Compilation error
Answer: b
Explanation: None.

9. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 0, l;
int z;
z = y = 1, l = x && y;
printf(“%d\n”, l);
return 0;
}
a) 0
b) 1
c) Undefined behaviour due to order of evaluation can be different
d) Compilation error
Answer: b
Explanation: None.

10. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int y = 2;
int z = y +(y = 10);
printf(“%d\n”, z);
}
a) 12
b) 20
c) 4
d) Either 12 or 20
Answer: b
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 2;
float f = y + x /= x / y;
printf(“%d %f\n”, x, f);
return 0;
}
a) 2 4.000000
b) Compile time error
c) 2 3.500000
d) Undefined behaviour
Answer: b
Explanation: None.

12. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 1, y = 2;
if (x && y == 1)
printf(“true\n”);
else
printf(“false\n”);
}
a) true
b) false
c) compile time error
d) undefined behaviour
Answer: b
Explanation: None.

13. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 1, y = 2;
int z = x & y == 2;
printf(“%d\n”, z);
}
a) 0
b) 1
c) Compile time error
d) Undefined behaviour
Answer: b
Explanation: None.

14. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 3, y = 2;
int z = x /= y %= 2;
printf(“%d\n”, z);
}
a) 1
b) Compile time error
c) Floating point exception
d) Segmentation fault
Answer: c
Explanation: None.

15. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 3, y = 2;
int z = x << 1 > 5;
printf(“%d\n”, z);
}
a) 1
b) 0
c) 3
d) Compile time error
Answer: a
Explanation: None.

16. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 3; //, y = 2;
const int *p = &x;
*p++;
printf(“%d\n”, *p);
}
a) Increment of read-only location compile error
b) 4
c) Some garbage value
d) Undefined behaviour
Answer: c
Explanation: None.

17. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 2;
int z = x ^ y & 1;
printf(“%d\n”, z);
}
a) 1
b) 2
c) 0
d) 1 or 2
Answer: b
Explanation: None.

18. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = x && y = 1;
printf(“%d\n”, z);
}
a) 0
b) 1
c) Compile time error
d) 2
Answer: c
Explanation: None.

19. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0, y = 2;
if (!x && y)
printf(“true\n”);
else
printf(“false\n”);
}
a) True
b) False
c) Compile time error
d) Undefined behaviour
Answer: a
Explanation: None.

20. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0, y = 2;
int z = ~x & y;
printf(“%d\n”, z);
}
a) -1
b) 2
c) 0
d) Compile time error
Answer: b
Explanation: None.

21. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = -3;
int k = i % 2;
printf(“%d\n”, k);
}
a) Compile time error
b) -1
c) 1
d) Implementation defined
Answer: b
Explanation: None.

22. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 3;
int l = i / -2;
int k = i % -2;
printf(“%d %d\n”, l, k);
return 0;
}
a) Compile time error
b) -1 1
c) 1 -1
d) Implementation defined
Answer: b
Explanation: None.

23. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 5;
i = i / 3;
printf(“%d\n”, i);
return 0;
}
a) Implementation defined
b) 1
c) 3
d) Compile time error
Answer: b
Explanation: None.

24. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = -5;
i = i / 3;
printf(“%d\n”, i);
return 0;
}
a) Implementation defined
b) -1
c) -3
d) Compile time error
Answer: b
Explanation: None.

25. What will be the final value of x in the following C code?

#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
a) 3.75
b) Depends on compiler
c) 24
d) 3
Answer: c
Explanation: None.

26. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf(“Value of x is %d”, x);
}
a) Value of x is 2.3
b) Value of x is 1
c) Value of x is 0.3
d) Compile time error
Answer: d
Explanation: None.

27. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int y = 3;
int x = 5 % 2 * 3 / 2;
printf(“Value of x is %d”, x);
}
a) Value of x is 1
b) Value of x is 2
c) Value of x is 3
d) Compile time error
Answer: a
Explanation: None.

28. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a = 3;
int b = ++a + a++ + –a;
printf(“Value of b is %d”, b);
}
a) Value of x is 12
b) Value of x is 13
c) Value of x is 10
d) Undefined behaviour
Answer: d
Explanation: None.

29. What is the precedence of arithmetic operators (from highest to lowest)?
a) %, *, /, +, –
b) %, +, /, *, –
c) +, -, %, *, /
d) %, +, -, *, /
Answer: a
Explanation: None.

30. Which of the following is not an arithmetic operation?
a) a * = 10;
b) a / = 10;
c) a ! = 10;
d) a % = 10;
Answer: c
Explanation: None.

31. Which of the following data type will throw an error on modulus operation(%)?
a) char
b) short
c) int
d) float
Answer: d
Explanation: None.

32. Which among the following are the fundamental arithmetic operators, i.e, performing the desired operation can be done using that operator only?
a) +, –
b) +, -, %
c) +, -, *, /
d) +, -, *, /, %
Answer: a
Explanation: None.

33. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 10;
double b = 5.6;
int c;
c = a + b;
printf(“%d”, c);
}
a) 15
b) 16
c) 15.6
d) 10
Answer: a
Explanation: None.

34. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = a == (b + c);
printf(“%d”, d);
}
a) Syntax error
b) 1
c) 10
d) 5
Answer: b
Explanation: None.

35. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y || z++;
printf(“%d”, z);
}
a) 6
b) 5
c) 0
d) Varies
Answer: a
Explanation: None.

36. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y && z++;
printf(“%d”, z);
}
a) 6
b) 5
c) 0
d) Varies
Answer: b
Explanation: None.

37. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 1, y = 0, z = 3;
x > y ? printf(“%d”, z) : return z;
}
a) 3
b) 1
c) Compile time error
d) Run time error
Answer: c
Explanation: None.

38. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 1, z = 3;
int y = x << 3;
printf(” %d\n”, y);
}
a) -2147483648
b) -1
c) Run time error
d) 8
Answer: d
Explanation: None.

39. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 0, y = 2, z = 3;
int a = x & y | z;
printf(“%d”, a);
}
a) 3
b) 0
c) 2
d) Run time error
Answer: a
Explanation: None.

40. What will be the final value of j in the following C code?

#include <stdio.h>
int main()
{
int i = 0, j = 0;
if (i && (j = i + 10))
//do something
;
}
a) 0
b) 10
c) Depends on the compiler
d) Depends on language standard
Answer: a
Explanation: None.

41. What will be the final value of j in the following C code?

#include <stdio.h>
int main()
{
int i = 10, j = 0;
if (i || (j = i + 10))
//do something
;
}
a) 0
b) 20
c) Compile time error
d) Depends on language standard
Answer: a
Explanation: None.

42. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 1;
if (i++ && (i == 1))
printf(“Yes\n”);
else
printf(“No\n”);
}
a) Yes
b) No
c) Depends on the compiler
d) Depends on the standard
Answer: b
Explanation: None.

43. Are logical operator sequence points?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
Answer: a
Explanation: None.

44. Do logical operators in the C language are evaluated with the short circuit?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
Answer: a
Explanation: None.

45. What is the result of logical or relational expression in C?
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned
Answer: b
Explanation: None.

46. What will be the final value of d in the following C code?

#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 5;
int d;
d = b + c == a;
printf(“%d”, d);
}
a) Syntax error
b) 1
c) 5
d) 10
Answer: b
Explanation: None.

47. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 10, b = 5, c = 3;
b != !a;
c = !!a;
printf(“%d\t%d”, b, c);
}
a) 5 1
b) 0 3
c) 5 3
d) 1 1
Answer: a
Explanation: None.

48. Which among the following is NOT a logical or relational operator?
a) !=
b) ==
c) ||
d) =
Answer: d
Explanation: None.

49. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 10;
if (a == a–)
printf(“TRUE 1\t”);
a = 10;
if (a == –a)
printf(“TRUE 2\t”);
}
a) TRUE 1
b) TRUE 2
c) TRUE 1  TRUE 2
d) Compiler Dependent
Answer: d
Explanation: This is a sequence point problem and hence the result will be implementation dependent.

50. Relational operators cannot be used on ____________
a) structure
b) long
c) strings
d) float
Answer: a
Explanation: None.

51. What is the difference between the following 2 codes?

#include <stdio.h> //Program 1
int main()
{
int d, a = 1, b = 2;
d = a++ + ++b;
printf(“%d %d %d”, d, a, b);
}
#include <stdio.h> //Program 2
int main()
{
int d, a = 1, b = 2;
d = a++ +++b;
printf(“%d %d %d”, d, a, b);
}
a) No difference as space doesn’t make any difference, values of a, b, d are same in both the case
b) Space does make a difference, values of a, b, d are different
c) Program 1 has syntax error, program 2 is not
d) Program 2 has syntax error, program 1 is not
Answer: d
Explanation: None.

52. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1, b = 1, c;
c = a++ + b;
printf(“%d, %d”, a, b);
}
a) a = 1, b = 1
b) a = 2, b = 1
c) a = 1, b = 2
d) a = 2, b = 2
Answer: b
Explanation: None.

53. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1, b = 1, d = 1;
printf(“%d, %d, %d”, ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);
}
a) 15, 4, 5
b) 9, 6, 9
c) 9, 3, 5
d) Undefined (Compiler Dependent)
Answer: d
Explanation: None.

54. For which of the following, “PI++;” code will fail?
a) #define PI 3.14
b) char *PI = “A”;
c) float PI = 3.14;
d) none of the Mentioned
Answer: a
Explanation: None.

55. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 10, b = 10;
if (a = 5)
b–;
printf(“%d, %d”, a, b–);
}
a) a = 10, b = 9
b) a = 10, b = 8
c) a = 5, b = 9
d) a = 5, b = 8
Answer: c
Explanation: None.

56. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
int j = i++ + i;
printf(“%d\n”, j);
}
a) 0
b) 1
c) 2
d) Compile time error
Answer: b
Explanation: None.

57. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 2;
int j = ++i + i;
printf(“%d\n”, j);
}
a) 6
b) 5
c) 4
d) Compile time error
Answer: a
Explanation: None.

58. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 2;
int i = i++ + i;
printf(“%d\n”, i);
}
a) = operator is not a sequence point
b) ++ operator may return value with or without side effects
c) it can be evaluated as (i++)+i or i+(++i)
d) = operator is a sequence point
Answer: a
Explanation: None.

59. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
int x = i++, y = ++i;
printf(“%d % d\n”, x, y);
return 0;
}
a) 0, 2
b) 0, 1
c) 1, 2
d) Undefined
Answer: a
Explanation: None.

60. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 10;
int *p = &i;
printf(“%d\n”, *p++);
}
a) 10
b) 11
c) Garbage value
d) Address of i
Answer: a
Explanation: None.

61. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf(“X is %d”, x);
}
a) X is 97
b) X is 98
c) X is 99
d) Run time error
Answer: a
Explanation: None.

62. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 4, y, z;
y = –x;
z = x–;
printf(“%d%d%d”, x, y, z);
}
a) 3 2 3
b) 2 3 3
c) 3 2 2
d) 2 3 4
Answer: b
Explanation: None.

63. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 4;
int *p = &x;
int *k = p++;
int r = p – k;
printf(“%d”, r);
}
a) 4
b) 8
c) 1
d) Run time error
Answer: c
Explanation: None.

64. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a = 5, b = -7, c = 0, d;
d = ++a && ++b || ++c;
printf(“\n%d%d%d%d”, a, b, c, d);
}
a) 6 -6 0 0
b) 6 -5 0 1
c) -6 -6 0 1
d) 6 -6 0 1
Answer: d
Explanation: None.

64. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a = -5;
int k = (a++, ++a);
printf(“%d\n”, k);
}
a) -4
b) -5
c) 4
d) -3
Answer: d
Explanation: None.

65. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int c = 2 ^ 3;
printf(“%d\n”, c);
}
a) 1
b) 8
c) 9
d) 0
Answer: a
Explanation: None.

66. What will be the output of the following C code?

#include <stdio.h>
int main()
{
unsigned int a = 10;
a = ~a;
printf(“%d\n”, a);
}
a) -9
b) -10
c) -11
d) 10
Answer: c
Explanation: None.

67. What will be the output of the following C code?

#include <stdio.h>
int main()
{
if (7 & 8)
printf(“Honesty”);
if ((~7 & 0x000f) == 8)
printf(“is the best policy\n”);
}
a) Honesty is the best policy
b) Honesty
c) is the best policy
d) No output
Answer: c
Explanation: None.

68. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 2;
if (a >> 1)
printf(“%d\n”, a);
}
a) 0
b) 1
c) 2
d) No Output
Answer: c
Explanation: None.

69. Comment on the output of the following C code.

#include <stdio.h>
int main()
{
int i, n, a = 4;
scanf(“%d”, &n);
for (i = 0; i < n; i++)
a = a * 2;
}
a) Logical Shift left
b) No output
c) Arithmetic Shift right
d) Bitwise exclusive OR
Answer: b
Explanation: None.

70. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf(“x is %d”, x);
}
a) x is 97
b) x is 98
c) x is 99
d) Run time error
Answer: a
Explanation: None.

71. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 4, y, z;
y = –x;
z = x–;
printf(“%d%d%d”, x, y, z);
}
a) 3 2 3
b) 2 2 3
c) 3 2 2
d) 2 3 3
Answer: d
Explanation: None.

72. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 4;
int *p = &x;
int *k = p++;
int r = p – k;
printf(“%d”, r);
}
a) 4
b) 8
c) 1
d) Run time error
Answer: c
Explanation: None.

73. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a = 5, b = -7, c = 0, d;
d = ++a && ++b || ++c;
printf(“\n%d%d%d%d”, a, b, c, d);
}
a) 6 -6 0 0
b) 6 -5 0 1
c) -6 -6 0 1
d) 6 -6 0 1
Answer: d
Explanation: None.

74. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a = -5;
int k = (a++, ++a);
printf(“%d\n”, k);
}
a) -3
b) -5
c) 4
d) Undefined
Answer: a
Explanation: None.

75. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 2;
x = x << 1;
printf(“%d\n”, x);
}
a) 4
b) 1
c) Depends on the compiler
d) Depends on the endianness of the machine
Answer: a
Explanation: None.

76. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = -2;
x = x >> 1;
printf(“%d\n”, x);
}
a) 1
b) -1
c) 2 31 – 1 considering int to be 4 bytes
d) Either -1 or 1
Answer: b
Explanation: None.

77. What will be the output of the following C code?

#include <stdio.h>
int main()
{
if (~0 == 1)
printf(“yes\n”);
else
printf(“no\n”);
}
a) yes
b) no
c) compile time error
d) undefined
Answer: b
Explanation: None.

78. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = -2;
if (!0 == 1)
printf(“yes\n”);
else
printf(“no\n”);
}
a) yes
b) no
c) run time error
d) undefined
Answer: a
Explanation: None.

79. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int y = 0;
if (1 |(y = 1))
printf(“y is %d\n”, y);
else
printf(“%d\n”, y);

}
a) y is 1
b) 1
c) run time error
d) undefined
Answer: a
Explanation: None.

80. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int y = 1;
if (y & (y = 2))
printf(“true %d\n”, y);
else
printf(“false %d\n”, y);

}
a) true 2
b) false 2
c) either true 2 or false 2
d) true 1
Answer: a
Explanation: None.

81. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 8;
int m = 7;
k < m ? k++ : m = k;
printf(“%d”, k);
}
a) 7
b) 8
c) Compile time error
d) Run time error
Answer: c
Explanation: None.

82. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 8;
int m = 7;
k < m ? k = k + 1 : m = m + 1;
printf(“%d”, k);
}
a) Compile time error
b) 9
c) 8
d) Run time error
Answer: a
Explanation: None.

83. What will be the final values of a and c in the following C statement? (Initial values: a = 2, c = 1)

c = (c) ? a = 0 : 2;
a) a = 0, c = 0;
b) a = 2, c = 2;
c) a = 2, c = 2;
d) a = 1, c = 2;
Answer: a
Explanation: None.

84. What will be the data type of the following expression? (Initial data type: a = int, var1 = double, var2 = float)

expression (a < 50)? var1 : var2;
a) int
b) float
c) double
d) Cannot be determined
Answer: c
Explanation: None.

85. Which expression has to be present in the following?
exp1 ? exp2 : exp3;
a) exp1
b) exp2
c) exp3
d) all of the mentioned
Answer: d
Explanation: None.

86. What will be the final value of c in the following C code snippet? (Initial values: a = 1, b = 2, c = 1)

c += (-c) ? a : b;
a) Syntax Error
b) c = 1
c) c = 2
d) c = 3
Answer: c
Explanation: None.

87. The following C code can be rewritten as _______

c = (n) ? a : b;
a)

if (!n)c = b;
else c = a;
b)

if (n <;= 0)c = b;
else c = a;
c)

if (n > 0)c = a;
else c = b;
d) All of the mentioned
Answer: a
Explanation: None.

Module 2

1. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf(“hello”);
if (x == 5)
printf(“hi”);
else
printf(“no”);
}
a) hi
b) hello
c) no
d) error
Answer: a
Explanation: None.

2. What will be the output of the following C code?

#include <stdio.h>
int x;
void main()
{
if (x)
printf(“hi”);
else
printf(“how are u”);
}
a) hi
b) how are you
c) compile time error
d) error
Answer: b
Explanation: None.

3. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf(“hello”);
}
a) It will display hello
b) It will throw an error
c) Nothing will be displayed
d) Compiler dependent
Answer: b
Explanation: None.

4. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 0;
if (x == 0)
printf(“hi”);
else
printf(“how are u”);
printf(“hello”);
}
a) hi
b) how are you
c) hello
d) hihello
Answer: d
Explanation: None.

5. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5;
if (x < 1);
printf(“Hello”);

}
a) Nothing
b) Run time error
c) Hello
d) Varies
Answer: c
Explanation: None.

6. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
double ch;
printf(“enter a value between 1 to 2:”);
scanf(“%lf”, &ch);
switch (ch)
{
case 1:
printf(“1”);
break;
case 2:
printf(“2”);
break;
}
}
a) Compile time error
b) 1
c) 2
d) Varies
Answer: a
Explanation: None.

7. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
char *ch;
printf(“enter a value between 1 to 3:”);
scanf(“%s”, ch);
switch (ch)
{
case “1”:
printf(“1”);
break;
case “2”:
printf(“2”);
break;
}
}
a) 1
b) 2
c) Compile time error
d) No Compile time error
Answer: c
Explanation: None.

8. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch)
{
case 1:
printf(“1\n”);
default:
printf(“2\n”);
}
}
a) 1
b) 2
c) 1 2
d) Run time error
Answer: c
Explanation: None.

9. What will be the output of the following C code? (Assuming that we have entered the value 2 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch)
{
case 1:
printf(“1\n”);
break;
printf(“Hi”);
default:
printf(“2\n”);
}
}
a) 1
b) Hi 2
c) Run time error
d) 2
Answer: d
Explanation: None.

10. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch, ch + 1)
{
case 1:
printf(“1\n”);
break;
case 2:
printf(“2”);
break;
}
}
a) 1
b) 2
c) 3
d) Run time error
Answer: b
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
printf(“inside if\n”);
else if (x > 0)
printf(“inside elseif\n”);
}
a) inside if
b) inside elseif
c)

inside if
inside elseif
d) compile time error
Answer: a
Explanation: None.

12. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0;
if (x++)
printf(“true\n”);
else if (x == 1)
printf(“false\n”);
}
a) true
b) false
c) compile time error
d) undefined behaviour
Answer: b
Explanation: None.

13. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x == 0)
printf(“inside if\n”);
else
printf(“inside else if\n”);
else
printf(“inside else\n”);
}
a) inside if
b) inside else if
c) inside else
d) compile time error
Answer: c
Explanation: None.

14. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0;
if (x == 0)
printf(“true, “);
else if (x = 10)
printf(“false, “);
printf(“%d\n”, x);
}
a) false, 0
b) true, 0
c) true, 10
d) compile time error
Answer: b
Explanation: None.

15. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x >= 0)
printf(“true\n”);
else
printf(“false\n”);
}
a) true
b) false
c) Depends on the compiler
d) No print statement
Answer: d
Explanation: None.

16. The C statement “”if (a == 1 || b == 2) {}”” can be re-written as ___________
a)

if (a == 1)
if (b == 2){}
b)

if (a == 1){}
if (b == 2){}
c)

if (a == 1){}
else if (b == 2){}
d) none of the mentioned
Answer: d
Explanation: None.

17. Which of the following is an invalid if-else statement?
a) if (if (a == 1)){}
b) if (func1 (a)){}
c) if (a){}
d) if ((char) a){}
Answer: a
Explanation: None.

18. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1;
if (a–)
printf(“True”);
if (a++)
printf(“False”);
}
a) True
b) False
c) True False
d) No Output
Answer: a
Explanation: None.

19. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1;
if (a)
printf(“All is Well “);
printf(“I am Well\n”);
else
printf(“I am not a River\n”);
}
a) Output will be All is Well I am Well
b) Output will be I am Well I am not a River
c) Output will be I am Well
d) Compile time errors during compilation
Answer: d
Explanation: None.

20. What will be the output of the following C code?

#include <stdio.h>
int main()
{
if (printf(“%d”, printf(“)))
printf(“We are Happy”);
else if (printf(“1”))
printf(“We are Sad”);
}
a) 0We are Happy
b) 1We are Happy
c) 1We are Sad
d) compile time error
Answer: d
Explanation: None.

21. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
double ch;
printf(“enter a value between 1 to 2:”);
scanf(“%lf”, &ch);
switch (ch)
{
case 1:
printf(“1”);
break;
case 2:
printf(“2”);
break;
}
}
a) Compile time error
b) 1
c) 2
d) Varies
Answer: a
Explanation: None.

22. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
char *ch;
printf(“enter a value between 1 to 3:”);
scanf(“%s”, ch);
switch (ch)
{
case “1”:
printf(“1”);
break;
case “2”:
printf(“2”);
break;
}
}
a) 1
b) Compile time error
c) 2
d) Run time error
Answer: b
Explanation: None.

23. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch)
{
case 1:
printf(“1\n”);
default:
printf(“2\n”);
}
}
a) 1
b) 2
c) 1 2
d) Run time error
Answer: c
Explanation: None.

24. What will be the output of the following C code? (Assuming that we have entered the value 2 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch)
{
case 1:
printf(“1\n”);
break;
printf(“hi”);
default:
printf(“2\n”);
}
}
a) 1
b) hi 2
c) Run time error
d) 2
Answer: d
Explanation: None.

25. What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input)

#include <stdio.h>
void main()
{
int ch;
printf(“enter a value between 1 to 2:”);
scanf(“%d”, &ch);
switch (ch, ch + 1)
{
case 1:
printf(“1\n”);
break;
case 2:
printf(“2”);
break;
}
}
a) 1
b) 2
c) 3
d) Run time error
Answer: b
Explanation: None.

26. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1, b = 1;
switch (a)
{
case a*b:
printf(“yes “);
case a-b:
printf(“no\n”);
break;
}
}
a) yes
b) no
c) Compile time error
d) yes no
Answer: c
Explanation: None.

27. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int x = 97;
switch (x)
{
case ‘a’:
printf(“yes “);
break;
case 97:
printf(“no\n”);
break;
}
}
a) yes
b) yes no
c) Duplicate case value error
d) Character case value error
Answer: c
Explanation: None.

28. What will be the output of the following C code?

#include <stdio.h>
int main()
{
float f = 1;
switch (f)
{
case 1.0:
printf(“yes\n”);
break;
default:
printf(“default\n”);
}
}
a) yes
b) yes default
c) Undefined behaviour
d) Compile time error
Answer: d
Explanation: None.

29. What will be the output of the following C code?

#include <stdio.h>
const int a = 1, b = 2;
int main()
{
int x = 1;
switch (x)
{
case a:
printf(“yes “);
case b:
printf(“no\n”);
break;
}
}
a) yes no
b) yes
c) no
d) Compile time error
Answer: d
Explanation: None.

30. What will be the output of the following C code?

#include <stdio.h>
#define max(a) a
int main()
{
int x = 1;
switch (x)
{
case max(2):
printf(“yes\n”);
case max(1):
printf(“no\n”);
break;
}
}
a) yes no
b) yes
c) no
d) Compile time error
Answer: c
Explanation: None.

31. What will be the output of the following C code?

#include <stdio.h>
int main()
{
switch (printf(“Do”))
{
case 1:
printf(“First\n”);
break;
case 2:
printf(“Second\n”);
break;
default:
printf(“Default\n”);
break;
}
}
a) Do
b) DoFirst
c) DoSecond
d) DoDefault
Answer: c
Explanation: None.

32. Comment on the output of the following C code.

#include <stdio.h>
int main()
{
int a = 1;
switch (a)
case 1:
printf(“%d”, a);
case 2:
printf(“%d”, a);
case 3:
printf(“%d”, a);
default:
printf(“%d”, a);
}
a) No error, output is 1111
b) No error, output is 1
c) Compile time error, no break statements
d) Compile time error, case label outside switch statement
Answer: d
Explanation: None.

33. Which datatype can accept the switch statement?
a) int
b) char
c) long
d) all of the mentioned
Answer: d
Explanation: None.

34. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1;
switch (a)
{
case a:
printf(“Case A “);
default:
printf(“Default”);
}
}
a) Output: Case A
b) Output: Default
c) Output: Case A Default
d) Compile time error
Answer: d
Explanation: None.

35. What will be the output of the following C code?

#include <stdio.h>
switch (ch)
{
case ‘a’:
case ‘A’:
printf(“true”);
}
a) if (ch == ‘a’ && ch == ‘A’) printf(“true”);
b)

if (ch == ‘a’)
if (ch == ‘a’) printf(“true”);
c) if (ch == ‘a’ || ch == ‘A’) printf(“true”);
d) none of the mentioned
Answer: c
Explanation: None.

36. The C code ‘for(;;)’ represents an infinite loop. It can be terminated by ___________
a) break
b) exit(0)
c) abort()
d) terminate
Answer: a
Explanation: None.

37. What will be the correct syntax for running two variable for loop simultaneously?
a)

for (i = 0; i < n; i++)
for (j = 0; j < n; j += 5)
b)

for (i = 0, j = 0; i < n, j < n; i++, j += 5)
c)

for (i = 0; i < n;i++){}
for (j = 0; j < n;j += 5){}
d) none of the mentioned
Answer: b
Explanation: None.

38. Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i < n; i++)?
a) for (i = n; i>0; i–)
b) for (i = n; i >= 0; i–)
c) for (i = n-1; i>0; i–)
d) for (i = n-1; i>-1; i–)
Answer: d
Explanation: None.

39. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3)?
a) variable
b) function
c) typedef
d) macros
Answer: d
Explanation: None.

40. What will be the output of the following C code?

#include <stdio.h>
int main()
{
short i;
for (i = 1; i >= 0; i++)
printf(“%d\n”, i);

}
a) The control won’t fall into the for loop
b) Numbers will be displayed until the signed limit of short and throw a runtime error
c) Numbers will be displayed until the signed limit of short and program will successfully terminate
d) This program will get into an infinite loop and keep printing numbers with no errors
Answer: c
Explanation: None.

41. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 0;
for (k)
printf(“Hello”);
}
a) Compile time error
b) hello
c) Nothing
d) Varies
Answer: a
Explanation: None.

42. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 0;
for (k < 3; k++)
printf(“Hello”);
}
a) Compile time error
b) Hello is printed thrice
c) Nothing
d) Varies
Answer: a
Explanation: None.

43. What will be the output of the following C code?

#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++)
printf(“Hello”);
}
a) Run time error
b) Hello is printed thrice
c) Hello is printed twice
d) Hello is printed infinitely
Answer: b
Explanation: None.

44. What will be the output of the following C code?

#include <stdio.h>
void main()
{
double k = 0;
for (k = 0.0; k < 3.0; k++);
printf(“%lf”, k);
}
a) 2.000000
b) 4.000000
c) 3.000000
d) Run time error
Answer: c
Explanation: None.

45. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k;
for (k = -3; k < -5; k++)
printf(“Hello”);
}
a) Hello
b) Infinite hello
c) Run time error
d) Nothing
Answer: d
Explanation: None.

46. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
for (; ; 😉
printf(“In for loop\n”);
printf(“After loop\n”);
}
a) Compile time error
b) Infinite loop
c) After loop
d) Undefined behaviour
Answer: a
Explanation: None.

47. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
for (i++; i == 1; i = 2)
printf(“In for loop “);
printf(“After loop\n”);
}
a) In for loop after loop
b) After loop
c) Compile time error
d) Undefined behaviour
Answer: a
Explanation: None.

48. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
for (foo(); i == 1; i = 2)
printf(“In for loop\n”);
printf(“After loop\n”);
}
int foo()
{
return 1;
}
a) After loop
b) In for loop after loop
c) Compile time error
d) Infinite loop
Answer: a
Explanation: None.

49. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int *p = NULL;
for (foo(); p; p = 0)
printf(“In for loop\n”);
printf(“After loop\n”);
}
a) In for loop after loop
b) Compile time error
c) Infinite loop
d) Depends on the value of NULL
Answer: b
Explanation: None.

50. What will be the output of the following C code?

#include <stdio.h>
int main()
{
for (int i = 0;i < 1; i++)
printf(“In for loop\n”);
}
a) Compile time error
b) In for loop
c) Depends on the standard compiler implements
d) Depends on the compiler
Answer: c
Explanation: None.

51. What will be the output of the following C code?

#include <stdio.h>
int main()
{
while ()
printf(“In while loop “);
printf(“After loop\n”);
}
a) In while loop after loop
b) After loop
c) Compile time error
d) Infinite loop
Answer: c
Explanation: None.

52. What will be the output of the following C code?

#include <stdio.h>
int main()
{
do
printf(“In while loop “);
while (0);
printf(“After loop\n”);
}
a) In while loop
b)

In while loop
after loop
c) After loop
d) Infinite loop
Answer: b
Explanation: None.

53. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf(“In while loop\n”);
} while (i < 3);
}
a)

In while loop
In while loop
In while loop
b)

In while loop
In while loop
c) Depends on the compiler
d) Compile time error
Answer: a
Explanation: None.

54. How many times i value is checked in the following C code?

#include <stdio.h>
int main()
{
int i = 0;
do {
i++;
printf(“in while loop\n”);
} while (i < 3);
}
a) 2
b) 3
c) 4
d) 1
Answer: b
Explanation: None.

55. How many times i value is checked in the following C code?

#include <stdio.h>
int main()
{
int i = 0;
while (i < 3)
i++;
printf(“In while loop\n”);
}
a) 2
b) 3
c) 4
d) 1
Answer: c
Explanation: None.

56. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 2;
do
{
printf(“Hi”);
} while (i < 2)
}
a) Compile time error
b) Hi Hi
c) Hi
d) Varies
Answer: a
Explanation: None.

57. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0;
while (++i)
{
printf(“H”);
}
}
a) H
b) H is printed infinite times
c) Compile time error
d) Varies
Answer: b
Explanation: None.

58. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0;
do
{
printf(“Hello”);
} while (i != 0);
}
a) Nothing
b) H is printed infinite times
c) Hello
d) Run time error
Answer: c
Explanation: None.

59. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *str = “”;
do
{
printf(“hello”);
} while (str);
}
a) Nothing
b) Run time error
c) Varies
d) Hello is printed infinite times
Answer: d
Explanation: None.

60. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0;
while (i < 10)
{
i++;
printf(“hi\n”);
while (i < 8)
{
i++;
printf(“hello\n”);
}
}
}
a) Hi is printed 8 times, hello 7 times and then hi 2 times
b) Hi is printed 10 times, hello 7 times
c) Hi is printed once, hello 7 times
d) Hi is printed once, hello 7 times and then hi 2 times
Answer: d
Explanation: None.

61. What is an example of iteration in C?
a) for
b) while
c) do-while
d) all of the mentioned
Answer: d
Explanation: None.

62. How many times while loop condition is tested in the following C code snippets, if i is initialized to 0 in both the cases?

while (i < n)
i++;
————-
do
i++;
while (i <= n);
a) n, n
b) n, n+1
c) n+1, n
d) n+1, n+1
Answer: d
Explanation: None.

63. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0;
while (i = 0)
printf(“True\n”);
printf(“False\n”);
}
a) True (infinite time)
b) True (1 time) False
c) False
d) Compiler dependent
Answer: c
Explanation: None.

64. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (i < 5, j < 10)
{
i++;
j++;
}
printf(“%d, %d\n”, i, j);
}
a) 5, 5
b) 5, 10
c) 10, 10
d) Syntax error
Answer: c
Explanation: None.

65. Which loop is most suitable to first perform the operation and then test the condition?
a) for loop
b) while loop
c) do-while loop
d) none of the mentioned
Answer: c
Explanation: None.

66. Which keyword can be used for coming out of recursion?
a) break
b) return
c) exit
d) both break and return
Answer: b
Explanation: None.

67. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 0, i = 0, b;
for (i = 0;i < 5; i++)
{
a++;
continue;
}
}
a) 2
b) 3
c) 4
d) 5
Answer: d
Explanation: None.

68. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 0, i = 0, b;
for (i = 0;i < 5; i++)
{
a++;
if (i == 3)
break;
}
}
a) 1
b) 2
c) 3
d) 4
Answer: d
Explanation: None.

69. The keyword ‘break’ cannot be simply used within _________
a) do-while
b) if-else
c) for
d) while
Answer: b
Explanation: None.

70. Which keyword is used to come out of a loop only for that iteration?
a) break
b) continue
c) return
d) none of the mentioned
Answer: b
Explanation: None.

71. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0, j = 0;
for (i = 0;i < 5; i++)
{
for (j = 0;j < 4; j++)
{
if (i > 1)
break;
}
printf(“Hi \n”);
}
}
a) Hi is printed 5 times
b) Hi is printed 9 times
c) Hi is printed 7 times
d) Hi is printed 4 times
Answer: a
Explanation: None.

72. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0;
int j = 0;
for (i = 0;i < 5; i++)
{
for (j = 0;j < 4; j++)
{
if (i > 1)
continue;
printf(“Hi \n”);
}
}
}
a) Hi is printed 9 times
b) Hi is printed 8 times
c) Hi is printed 7 times
d) Hi is printed 6 times
Answer: b
Explanation: None.

73. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 0;
for (i = 0;i < 5; i++)
if (i < 4)
{
printf(“Hello”);
break;
}
}
a) Hello is printed 5 times
b) Hello is printed 4 times
c) Hello
d) Hello is printed 3 times
Answer: c
Explanation: None.

74. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int i = 5, k;
if (i == 0)
goto label;
label: printf(“%d”, i);
printf(“Hey”);
}
a) 5
b) Hey
c) 5 Hey
d) Nothing
Answer: c
Explanation: None.

75. goto can be used to jump from main() to within a function.
a) true
b) false
c) depends
d) varies
Answer: b
Explanation: None.

76. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“%d “, 1);
goto l1;
printf(“%d “, 2);
l1:goto l2;
printf(“%d “, 3);
l2:printf(“%d “, 4);
}
a) 1 4
b) Compile time error
c) 1 2 4
d) 1 3 4
Answer: a
Explanation: None.

77. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“%d “, 1);
l1:l2:
printf(“%d “, 2);
printf(“%d\n”, 3);
}
a) Compile time error
b) 1 2 3
c) 1 2
d) 1 3
Answer: b
Explanation: None.

78. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“%d “, 1);
goto l1;
printf(“%d “, 2);
}
void foo()
{
l1: printf(“3 “, 3);
}
a) 1 2 3
b) 1 3
c) 1 3 2
d) Compile time error
Answer: d
Explanation: None.

79. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (i < 2)
{
l1: i++;
while (j < 3)
{
printf(“loop\n”);
goto l1;
}
}
}
a) loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop
Answer: d
Explanation: None.

80. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0, j = 0;
while (l1: i < 2)
{
i++;
while (j < 3)
{
printf(“loop\n”);
goto l1;
}
}
}
a) loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop
Answer: b
Explanation: None.

81. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 0, j = 0;
l1: while (i < 2)
{
i++;
while (j < 3)
{
printf(“loop\n”);
goto l1;
}
}
}
a) loop loop
b) Compile time error
c) loop loop loop loop
d) Infinite loop
Answer: a
Explanation: None.

Module 3

1. What will be the output of the following C code?
#include <stdio.h>
int main()
{
void foo();
printf(“1 “);
foo();
}
void foo()
{
printf(“2 “);
}
a) 1 2
b) Compile time error
c) 1 2 1 2
d) Depends on the compiler
Answer: a
Explanation: None.

2. What will be the output of the following C code?

#include <stdio.h>
int main()
{
void foo(), f();
f();
}
void foo()
{
printf(“2 “);
}
void f()
{
printf(“1 “);
foo();
}
a) Compile time error as foo is local to main
b) 1 2
c) 2 1
d) Compile time error due to declaration of functions inside main
Answer: b
Explanation: None.

3. What will be the output of the following C code?

#include <stdio.h>
int main()
{
void foo();
void f()
{
foo();
}
f();
}
void foo()
{
printf(“2 “);
}
a) 2 2
b) 2
c) Compile time error
d) Depends on the compiler
Answer: d
Explanation: Even though the answer is 2, this code will compile fine only with gcc. GNU C supports nesting of functions in C as a language extension whereas standard C compiler doesn’t.

4. What will be the output of the following C code?

#include <stdio.h>
void foo();
int main()
{
void foo();
foo();
return 0;
}
void foo()
{
printf(“2 “);
}
a) Compile time error
b) 2
c) Depends on the compiler
d) Depends on the standard
Answer: b
Explanation: None.

5. What will be the output of the following C code?

#include <stdio.h>
void foo();
int main()
{
void foo(int);
foo(1);
return 0;
}
void foo(int i)
{
printf(“2 “);
}
a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
Answer: a
Explanation: None.

6. What will be the output of the following C code?

#include <stdio.h>
void foo();
int main()
{
void foo(int);
foo();
return 0;
}
void foo()
{
printf(“2 “);
}
a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
Answer: b
Explanation: None.

7. What will be the output of the following C code?

#include <stdio.h>
void m()
{
printf(“hi”);
}
void main()
{
m();
}
a) hi
b) Run time error
c) Nothing
d) Varies
Answer: a
Explanation: None.

8. What will be the output of the following C code?

#include <stdio.h>
void m();
void n()
{
m();
}
void main()
{
void m()
{
printf(“hi”);
}
}
a) hi
b) Compile time error
c) Nothing
d) Varies
Answer: b
Explanation: None.

9. What will be the output of the following C code?

#include <stdio.h>
void main()
{
m();
void m()
{
printf(“hi”);
}
}
a) hi
b) Compile time error
c) Nothing
d) Varies
Answer: b
Explanation: None.

10. What will be the output of the following C code?

#include <stdio.h>
void main()
{
m();
}
void m()
{
printf(“hi”);
m();
}
a) Compile time error
b) hi
c) Infinite hi
d) Nothing
Answer: c
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
void main()
{
static int x = 3;
x++;
if (x <= 5)
{
printf(“hi”);
main();
}
}
a) Run time error
b) hi
c) Infinite hi
d) hi hi
Answer: d
Explanation: None.

12. Which of the following is a correct format for declaration of function?
a) return-type function-name(argument type);
b) return-type function-name(argument type){}
c) return-type (argument type)function-name;
d) all of the mentioned
Answer: a
Explanation: None.

13. Which of the following function declaration is illegal?
a) int 1bhk(int);
b) int 1bhk(int a);
c) int 2bhk(int*, int []);
d) all of the mentioned
Answer: d
Explanation: None.

14. Which function definition will run correctly?
a)

int sum(int a, int b)
return (a + b);
b)

int sum(int a, int b)
{return (a + b);}
c)

int sum(a, b)
return (a + b);
d) none of the mentioned
Answer: b
Explanation: None.

15. Can we use a function as a parameter of another function? [Eg: void wow(int func())].
a) Yes, and we can use the function value conveniently
b) Yes, but we call the function again to get the value, not as convenient as in using variable
c) No, C does not support it
d) This case is compiler dependent
Answer: c
Explanation: None.

16. The value obtained in the function is given back to main by using ________ keyword.
a) return
b) static
c) new
d) volatile
Answer: a
Explanation: None.

17. What will be the output of the following C code?

#include<stdio.h>
main()
{
int n;
n=f1(4);
printf(“%d”,n);
}
f1(int x)
{
int b;
if(x==1)
return 1;
else
b=x*f1(x-1);
return b;
}
a) 24
b) 4
c) 12
d) 10
Answer: a
Explanation: The above code returns the factorial of a given number using the method of recursion. The given number is 4 in the above code, hence the factorial of 4, that is, 24 will be returned.

18. The data structure used to implement recursive function calls _____________
a) Array
b) Linked list
c) Binary tree
d) Stack
Answer: d
Explanation: The compiler uses the data type stack for implementing normal as well as recursive function calls.

19. The principle of stack is __________
a) First in first out
b) First in last out
c) Last in first out
d) Last in last out
Answer: c
Explanation: A stack is a last in first out(LIFO) data type. This means that the last item to get stored in the stack is the first item to get out of it.

20. In the absence of a exit condition in a recursive function, the following error is given __________
a) Compile time error
b) Run time error
c) Logical error
d) No error
Answer: b
Explanation: When a recursive function is called in the absence of an exit condition, it results in an infinite loop due to which the stack keeps getting filled(stack overflow). This results in a run time error.

21. What will be the output of the following C code?

#include<stdio.h>
main()
{
int n,i;
n=f(6);
printf(“%d”,n);
}
f(int x)
{
if(x==2)
return 2;
else
{
printf(“+”);
f(x-1);
}
}
a) ++++2
b) +++++2
c) +++++
d) 2
Answer: a
Explanation:
When x=6: ‘+’ is printed.
When x=5: ‘+’ is printed.
When x=4: ‘+’ is printed.
When x=3: ‘+’ is printed.
When x=2: 2 is printed.
Hence the output is: ++++2.

22. How many times is ‘a’ printed when the following C code is executed?

#include<stdio.h>
main()
{
int a;
a=f1(10);
printf(“%d”,a);
}
f1(int b)
{
if(b==0)
return 0;
else
{
printf(“a”);
f1(b–);
}
}
a) 9 times
b) 10 times
c) 0 times
d) Infinite number of times
Answer: d
Explanation: Although we have specified the exit condition, the code above results in an infinite loop because we have used b- -(decrement operator) to call the recursive function. Due to this, the loop goes on infinitely. However, if we had used f1(b-1) instead, the answer would have been 10 times.

23. What will be the output of the following C code?

#include<stdio.h>
main()
{
int n=10;
int f(int n);
printf(“%d”,f(n));
}
int f(int n)
{
if(n>0)
return(n+f(n-2));
}
a) 10
b) 80
c) 30
d) Error
Answer: c
Explanation: The recursive function returns n+f(n-2) till 10>0.
Therefore, the above code will be evaluated as: 10+8+6+4+2, which is equal to 30.

24. What will be the output of the following C code?

#include<stdio.h>
int main()
{
printf(“Hello”);
main();
return 0;
}
a) Hello is printed once
b) Hello infinite number of times
c) Hello is not printed at all
d) 0 is returned
Answer: b
Explanation: in the above code, we are calling main() from main(), which is recursion. However, we have not defined any condition for the program to exit. Hence, “hello” will be printed infinite number of times. To prevent this, we need to define a proper exit condition in the recursive function.

25. Iteration requires more system memory than recursion.
a) True
b) False
Answer: b
Explanation: Recursion requires more system memory than iteration due to the maintenance of stack.

26. What will be the output of the following C code?

#include <stdio.h>
void main()
{
m();
printf(“%d”, x);
}
int x;
void m()
{
x = 4;
}
a) 4
b) Compile time error
c) 0
d) Undefined
Answer: b
Explanation: None.

27. What will be the output of the following C code?

#include <stdio.h>
int x;
void main()
{
printf(“%d”, x);
}
a) Junk value
b) Run time error
c) 0
d) Undefined
Answer: c
Explanation: None.

28. What will be the output of the following C code?

#include <stdio.h>
int x = 5;
void main()
{
int x = 3;
printf(“%d”, x);
{
x = 4;
}
printf(“%d”, x);
}
a) Run time error
b) 3 3
c) 3 5
d) 3 4
Answer: d
Explanation: None.

29. What will be the output of the following C code?

#include <stdio.h>
int x = 5;
void main()
{
int x = 3;
printf(“%d”, x);
{
int x = 4;
}
printf(“%d”, x);
}
a) 3 3
b) 3 4
c) 3 5
d) Run time error
Answer: a
Explanation: None.

30. Functions in C are always _________
a) Internal
b) External
c) Both Internal and External
d) External and Internal are not valid terms for functions
Answer: b
Explanation: None.

31. Global variables are ____________
a) Internal
b) External
c) Both Internal and External
d) None of the mentioned
Answer: b
Explanation: None.

32. Which of the following is an external variable in the following C code?

#include <stdio.h>
int func (int a)
{
int b;
return b;
}
int main()
{
int c;
func (c);
}
int d;
a) a
b) b
c) c
d) d
Answer: d
Explanation: None.

33. What will be the output of the following C code?

#include <stdio.h>
int main()
{
printf(“%d”, d++);
}
int d = 10;
a) 9
b) 10
c) 11
d) Compile time error
Answer: d
Explanation: None.

34. What will be the output of the following C code?

#include <stdio.h>
double var = 8;
int main()
{
int var = 5;
printf(“%d”, var);
}
a) 5
b) 8
c) Compile time error due to wrong format identifier for double
d) Compile time error due to redeclaration of variable with same name
Answer: a
Explanation: None.

35. What will be the sequence of allocation and deletion of variables in the following C code?

#include <stdio.h>
int main()
{
int a;
{
int b;
}
}
a) a->b, a->b
b) a->b, b->a
c) b->a, a->b
d) b->a, b->a
Answer: b
Explanation: None.

36. Array sizes are optional during array declaration by using ______ keyword.
a) auto
b) static
c) extern
d) register
Answer: c
Explanation: None.

37. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 3;
{
x = 4;
printf(“%d”, x);
}
}
a) 4
b) 3
c) 0
d) Undefined
Answer: a
Explanation: None.

38. What will be the output of the following C code?

#include <stdio.h>
int x = 5;
void main()
{
int x = 3;
m();
printf(“%d”, x);
}
void m()
{
x = 8;
n();
}
void n()
{
printf(“%d”, x);
}
a) 8 3
b) 3 8
c) 8 5
d) 5 3
Answer: a
Explanation: None.

39. What will be the output of the following C code?

#include <stdio.h>
int x;
void main()
{
m();
printf(“%d”, x);
}
void m()
{
x = 4;
}
a) 0
b) 4
c) Compile time error
d) Undefined
Answer: b
Explanation: None.

40. What will be the output of the following C code?

#include <stdio.h>
static int x = 5;
void main()
{
int x = 9;
{
x = 4;
}
printf(“%d”, x);
}
a) 9
b) 5
c) 4
d) 0
Answer: c
Explanation: None.

41. What will be the output of the following C code?

#include <stdio.h>
void main()
{
{
int x = 8;
}
printf(“%d”, x);
}
a) 8
b) 0
c) Undefined
d) Compile time error
Answer: d
Explanation: None.

42. What will be the output of the following C code?

#include <stdio.h>
void main()
{
m();
m();
}
void m()
{
static int x = 5;
x++;
printf(“%d”, x);
}
a) 6 7
b) 6 6
c) 5 5
d) 5 6
Answer: a
Explanation: None.

43. What will be the output of the following C code?

#include <stdio.h>
void main()
{
static int x;
printf(“x is %d”, x);
}
a) 0
b) 1
c) Junk value
d) Run time error
Answer: a
Explanation: None.

44. What will be the output of the following C code?

#include <stdio.h>
static int x;
void main()
{
int x;
printf(“x is %d”, x);
}
a) 0
b) Junkvalue
c) Run time error
d) Nothing
Answer: b
Explanation: None.

45. What will be the output of the following C code?

#include <stdio.h>
void main()
{
static double x;
int x;
printf(“x is %d”, x);
}
a) Nothing
b) 0
c) Compile time error
d) Junkvalue
Answer: c
Explanation: None.

46. What will be the output of the following C code?

#include <stdio.h>
void main()
{
static int x;
if (x++ < 2)
main();
}
a) Infinite calls to main
b) Run time error
c) Varies
d) main is called twice
Answer: d
Explanation: None.

47. Which of following is not accepted in C?
a) static a = 10; //static as
b) static int func (int); //parameter as static
c) static static int a; //a static variable prefixed with static
d) all of the mentioned
Answer: c
Explanation: None.

48. Which of the following cannot be static in C?
a) Variables
b) Functions
c) Structures
d) None of the mentioned
Answer: d
Explanation: None.

49. When compiler accepts the request to use the variable as a register?
a) It is stored in CPU
b) It is stored in cache memory
c) It is stored in main memory
d) It is stored in secondary memory
Answer: a
Explanation: None.

50. Which data type can be stored in register?
a) int
b) long
c) float
d) all of the mentioned
Answer: d
Explanation: None.

51. Which of the following operation is not possible in a register variable?
a) Reading the value into a register variable
b) Copy the value from a memory variable
c) Global declaration of register variable
d) All of the mentioned
Answer: d
Explanation: None.

52. Which among the following is the correct syntax to declare a static variable register?
a) static register a;
b) register static a;
c) Both static register a; and register static a;
d) We cannot use static and register together
Answer: d
Explanation: None.

53. Register variables reside in ________
a) stack
b) registers
c) heap
d) main memory
Answer: b
Explanation: None.

54. What will be the output of the following C code?

#include <stdio.h>
void main()
{
register int x = 0;
if (x < 2)
{
x++;
main();
}
}
a) Segmentation fault
b) main is called twice
c) main is called once
d) main is called thrice
Answer: a
Explanation: None.

55. What will be the output of the following C code?

#include <stdio.h>
void main()
{
register int x;
printf(“%d”, x);
}
a) 0
b) Junk value
c) Compile time error
d) Nothing
Answer: b
Explanation: None.

56. What will be the output of the following C code?

#include <stdio.h>
register int x;
void main()
{
printf(“%d”, x);
}
a) Varies
b) 0
c) Junk value
d) Compile time error
Answer: d
Explanation: None.

57. Automatic variables are _________
a) Declared within the scope of a block, usually a function
b) Declared outside all functions
c) Declared with the auto keyword
d) Declared within the keyword extern
Answer: a
Explanation: None.

58. What is the scope of an automatic variable?
a) Exist only within that scope in which it is declared
b) Cease to exist after the block is exited
c) Exist only within that scope in which it is declared & exist after the block is exited
d) All of the mentioned
Answer: c
Explanation: None.

59. Automatic variables are allocated memory in ___________
a) heap
b) Data segment
c) Code segment
d) stack
Answer: d
Explanation: None.

60. What will be the x in the following C code?
#include <stdio.h>
void main()
{
int x;
}
a) automatic variable
b) static variable
c) register variable
d) global variable
Answer: a
Explanation: None.

61. Automatic variables are initialized to ___________
a) Zero
b) Junk value
c) Nothing
d) Both Zero & Junk value
Answer: b
Explanation: None.

62. Which of the following storage class supports char data type?
a) register
b) static
c) auto
d) all of the mentioned
Answer: d
Explanation: None.

63. A local variable declaration with no storage class specified is by default _________
a) auto
b) extern
c) static
d) register
Answer: a
Explanation: None.

Module 4

1. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf(“%d”, a[i][j]);
}
a) 1 2 3 4 5 0
b) 1 2 3 4 5 junk
c) 1 2 3 4 5 5
d) Run time error
Answer: a
Explanation: None.

2. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, , 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf(“%d”, a[i][j]);
}
a) 1 2 3 junk 4 5
b) Compile time error
c) 1 2 3 0 4 5
d) 1 2 3 3 4 5
Answer: b
Explanation: None.
advertisement

3. What will be the output of the following C code?

#include <stdio.h>
void f(int a[][3])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf(“%d”, a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}
a) 0 3 0 0 0 0
b) Junk 3 junk junk junk junk
c) Compile time error
d) All junk values
Answer: a
Explanation: None.

4. What will be the output of the following C code?

#include <stdio.h>
void f(int a[][])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0;i < 2; i++)
for (j = 0;j < 3; j++)
printf(“%d”, a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}
a) 0 3 0 0 0 0
b) Junk 3 junk junk junk junk
c) Compile time error
d) All junk values
Answer: c
Explanation: None.

5. What will be the output of the following C code?

#include <stdio.h>
void f(int a[2][])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0;i < 2; i++)
for (j = 0;j < 3; j++)
printf(“%d”, a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}
a) 0 3 0 0 0 0
b) Junk 3 junk junk junk junk
c) Compile time error
d) All junk values
Answer: c
Explanation: None.

6. Comment on the following C statement.
int (*a)[7];
a) An array “a” of pointers
b) A pointer “a” to an array
c) A ragged array
d) None of the mentioned
Answer: b
Explanation: None.

7. Comment on the following 2 arrays with respect to P and Q.

int *a1[8];
int *(a2[8]);
P. Array of pointers
Q. Pointer to an array
a) a1 is P, a2 is Q
b) a1 is P, a2 is P
c) a1 is Q, a2 is P
d) a1 is Q, a2 is Q
Answer: b
Explanation: None.

8. Which of the following is not possible statically in C?
a) Jagged Array
b) Rectangular Array
c) Cuboidal Array
d) Multidimensional Array
Answer: a
Explanation: None.

9. What is the correct syntax to send a 3-dimensional array as a parameter? (Assuming declaration int a[5][4][3];)
a) func(a);
b) func(&a);
c) func(*a);
d) func(**a);
Answer: a
Explanation: None.

10. What are the applications of a multidimensional array?
a) Matrix-Multiplication
b) Minimum Spanning Tree
c) Finding connectivity between nodes
d) All of the mentioned
Answer: d
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[2][3];
foo(ary);
}
void foo(int *ary[])
{
int i = 10, j = 2, k;
ary[0] = &i;
ary[1] = &j;
*ary[0] = 2;
for (k = 0;k < 2; k++)
printf(“%d\n”, *ary[k]);
}
a) 2 2
b) Compile time error
c) Undefined behaviour
d) 10 2
Answer: a
Explanation: None.
advertisement

12. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[2][3];
foo(ary);
}
void foo(int (*ary)[3])
{
int i = 10, j = 2, k;
ary[0] = &i;
ary[1] = &j;
for (k = 0;k < 2; k++)
printf(“%d\n”, *ary[k]);
}
a) Compile time error
b) 10 2
c) Undefined behaviour
d) segmentation fault/code crash
Answer: a
Explanation: None.

13. What will be the output of the following C code?

#include <stdio.h>
int main()
{
foo(ary);
}
void foo(int **ary)
{
int i = 10, k = 10, j = 2;
int *ary[2];
ary[0] = &i;
ary[1] = &j;
printf(“%d\n”, ary[0][1]);
}
a) 10
b) 2
c) Compile time error
d) Undefined behaviour
Answer: d
Explanation: None.

14. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[2][3][4], j = 20;
ary[0][0] = &j;
printf(“%d\n”, *ary[0][0]);
}
a) Compile time error
b) 20
c) Address of j
d) Undefined behaviour
Answer: a
Explanation: None.

15. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[2][3];
ary[][] = {{1, 2, 3}, {4, 5, 6}};
printf(“%d\n”, ary[1][0]);
}
a) Compile time error
b) 4
c) 1
d) 2
Answer: a
Explanation: None.

16. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
printf(“%p\t%p”, p, a);
}
a) Same address is printed
b) Different address is printed
c) Compile time error
d) Nothing
Answer: a
Explanation: None.

17. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s = “hello”;
char *p = s;
printf(“%p\t%p”, p, s);
}
a) Different address is printed
b) Same address is printed
c) Run time error
d) Nothing
Answer: b
Explanation: None.
advertisement

18. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, p[0], s[1]);
}
a) Run time error
b) h h
c) h e
d) h l
Answer: c
Explanation: None.

19. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, *(p + 3), s[1]);
}
a) h e
b) l l
c) l o
d) l e
Answer: d
Explanation: None.

20. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, 1[p], s[1]);
}
a) h h
b) Run time error
c) l l
d) e e
Answer: d
Explanation: None.

21. What will be the output of the following C code?

#include <stdio.h>
void foo( int[] );
int main()
{
int ary[4] = {1, 2, 3, 4};
foo(ary);
printf(“%d “, ary[0]);
}
void foo(int p[4])
{
int i = 10;
p = &i;
printf(“%d “, p[0]);
}
a) 10 10
b) Compile time error
c) 10 1
d) Undefined behaviour
Answer: c
Explanation: None.

22. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf(“%d\n”, p[-2]);
}
a) 1
b) 2
c) Compile time error
d) Some garbage value
Answer: b
Explanation: None.

23. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf(“%d %d\n”, p[-2], ary[*p]);
}
a) 2 3
b) Compile time error
c) 2 4
d) 2 somegarbagevalue
Answer: d
Explanation: None.

24. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
printf(“%d\n”, *ary);
}
a) 1
b) Compile time error
c) Some garbage value
d) Undefined variable
Answer: a
Explanation: None.

25. What will be the output of the following C code?

#include <stdio.h>
int main()
{
const int ary[4] = {1, 2, 3, 4};
int *p;
p = ary + 3;
*p = 5;
printf(“%d\n”, ary[3]);
}
a) 4
b) 5
c) Compile time error
d) 3
Answer: b
Explanation: None.
advertisement

26. What are the different ways to initialize an array with all elements as zero?
a) int array[5] = {};
b) int array[5] = {0};
c)int a = 0, b = 0, c = 0;
int array[5] = {a, b, c};
d) All of the mentioned
Answer: d
Explanation: None.

27. What are the elements present in the array of the following C code?
int array[5] = {5};
a) 5, 5, 5, 5, 5
b) 5, 0, 0, 0, 0
c) 5, (garbage), (garbage), (garbage), (garbage)
d) (garbage), (garbage), (garbage), (garbage), 5
Answer: b
Explanation: None.

28. Which of the following declaration is illegal?
a)int a = 0, b = 1, c = 2;
int array[3] = {a, b, c};
b)int size = 3;
int array[size];
c)int size = 3;
int array[size] = {1, 2, 3};
d) All of the mentioned
Answer: c
Explanation: None.

29. An array of similar data types which themselves are a collection of dissimilar data type are ___________
a) Linked Lists
b) Trees
c) Array of Structure
d) All of the mentioned
Answer: c
Explanation: None.

30. Comment on an array of the void data type.
a) It can store any data-type
b) It only stores element of similar data type to first element
c) It acquires the data type with the highest precision in it
d) You cannot have an array of void data type
Answer: d
Explanation: None.

31. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int p[4];
p = ary;
printf(“%d\n”, p[1]);
}
a) 1
b) Compile time error
c) Undefined behaviour
d) 2
Answer: b
Explanation: None.

32. There are two groups of string functions defined in the header <string.h>. What are they?
a) first group names beginning with str; second group names beginning with mem
b) first group names beginning with str; second group names beginning with is
c) first group names beginning with string; second group names beginning with mem
d) first group names beginning with str; second group names beginning with type
Answer: a
Explanation: There are two groups of string functions declared under the header <string.h>. The first have names beginning with str and second have names beginning with mem.

33. What is the use of function char *strchr(ch, c)?
a) return pointer to first occurrence of ch in c or NULL if not present
b) return pointer to first occurrence of c in ch or NULL if not present
c) return pointer to first occurrence of ch in c or ignores if not present
d) return pointer to first occurrence of cin ch or ignores if not present
Answer: b
Explanation: The given code char *strchr(ch, c) return pointer to first occurrence of c in ch or NULL if not present.

34. Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?
a) char *strchr(ch, c)
b) char *strrchr(ch, c)
c) char *strncat(ch, c)
d) char *strcat(ch, c)
Answer: b
Explanation: The function char *strrchr(ch, c) returns pointer to last occurrence of c in ch or NULL if not present.

35. Which among the given options compares atmost n characters of string ch to string s?
a) int strncmp(ch, s, n)
b) int strcmp(ch, s)
c) int strncmp(s, ch, n)
d) int strcmp(s, ch)
Answer: a
Explanation: int strncmp(ch, s, n) is used to compare at most n characters of string ch to string s; return <0 if ch0 of ch >s.
advertisement

36. Which among the given options is the right explanation for the statement size_t strcspn(c, s)?
a) return length of prefix of s consisting of characters not in c
b) return length of prefix of s consisting of characters present in c
c) return length of prefix of c consisting of characters not in s
d) return length of prefix of c consisting of characters present in s
Answer: c
Explanation: The function size_t strcspn(c, s) is used to return length of prefix of c consisting of characters not in s.

37. The mem functions are meant for _______
a) returning a pointer to the token
b) manipulating objects as character arrays
c) returning a pointer for implemented-defined string
d) returning a pointer to first occurrence of string in another string
Answer: b
Explanation: The mem functions is used for manipulating objects as character arrays.

38. What is the function of void *memset(s, c, n)?
a) places character s into first n characters of c, return c
b) places character c into first n characters of s, return s
c) places character s into first n characters of c, return s
d) places character c into first n character of s, return c
Answer: b
Explanation: The void *memset(s, c, n) places character c into first n characters of s, return s.

39. Functions whose names begin with “strn”
a) manipulates sequences of arbitrary characters
b) manipulates null-terminated sequences of characters
c) manipulates sequence of non – null characters.
d) returns a pointer to the token
Answer: c
Explanation: Functions whose names begin with “strn” manipulates the sequence of non-null characters.

40. Which of the following is the right syntax to copy n characters from the object pointed to by s2 into the object pointed to by s1?
a) void *memcpy(void *s1,const void *s2,size_t n);
b) void *memcpy(void *s2, const void *s1, size_t n);
c) void memcpy(void *s1,const void *s2, size_t n);
d) void memcpy(void *s2,const void *s1,size_t n);
Answer: a
Explanation: The memcpy() function copies n characters from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

41. What does the following function returns void *memmove(void *s1,const void s2, size_t n);?
a) returns the value of s1
b) returns the value of s2
c) doesn’t return any value
d) returns the value of s1 and s2
Answer: a
Explanation: The memmove() function copies n characters from the object pointed to by s2 into the object pointed to by s1.The memmove() function returns the value of s1.

42. Which among the following is Copying function?
a) memcpy()
b) strcopy()
c) memcopy()
d) strxcpy()
Answer: a
Explanation: The memcpy() function is used to copy n characters from the object.
The code is void *memcpy(void *s1,const void *s2, size_t n).

43. Which function will you choose to join two words?
a) strcpy()
b) strcat()
c) strncon()
d) memcon()
Answer: b
Explanation: The strcat() function is used for concatenating two strings, appends a copy of the string.
char *strcat(char *s1,const char *s2);

44. The ______ function appends not more than n characters.
a) strcat()
b) strcon()
c) strncat()
d) memcat()
Answer: c
Explanation: The strncat() function appends not more than n characters from the array(s2) to the end of the string(s1).char *strncat(char *s1, const char *s2,size_t n);

45. What will strcmp() function do?
a) compares the first n characters of the object
b) compares the string
c) undefined function
d) copies the string
Answer: b
Explanation: The strcmp() function compares the string s1 to the string s2.
int strcmp(const char *s1,const char *s2);

46. What is the prototype of strcoll() function?
a) int strcoll(const char *s1,const char *s2)
b) int strcoll(const char *s1)
c) int strcoll(const *s1,const *s2)
d) int strcoll(const *s1)
Answer: a
Explanation: The prototype of strcoll() function is int strcoll(const char *s1,const char *s2).
advertisement

47. What is the function of strcoll()?
a) compares the string, result is dependent on the LC_COLLATE
b) copies the string, result is dependent on the LC_COLLATE
c) compares the string, result is not dependent on the LC_COLLATE
d) copies the string, result is not dependent on the LC_COLLATE
Answer: a
Explanation: The strcoll() function compares the string s1 to the string s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.

48. Which of the following is the variable type defined in header string. h?
a) sizet
b) size
c) size_t
d) size-t
Answer: c
Explanation: This is the unsigned integral type and is the result of the sizeof keyword.

49. NULL is the macro defined in the header string. h.
a) true
b) false
Answer: a
Explanation: NULL macro is the value of a null pointer constant.

50. What will be the output of the following C code?
const char pla[] = “string1”;
const char src[] = “string2”;
printf(“Before memmove place= %s, src = %s\n”, pla, src);
memmove(pla, src, 7);
printf(“After memmove place = %s, src = %s\n”, pla, src);
a) Before memmove place= string1, src = string2 After memmove place = string2, src = string2
b) Before memmove place = string2, src = string2 After memmove place= string1, src = string2
c) Before memmove place = string2, src = string1 After memmove place= string2, src =string2
d) Before memmove place= string1, src = string2 After memmove place=string1, src = string1
Answer: a
Explanation: In the C library function void *memmove(void *str1, const void *str2, size_t n) copies n characters from str2 to str1.

51. What will be the output of the following C code?
const char str1[]=”ABCDEF1234567″;
const char str2[] = “269”;
len = strcspn(str1, str2);
printf(“First matching character is at %d\n”, len + 1);
a) First matching character is at 8
b) First matching character is at 7
c) First matching character is at 9
d) First matching character is at 12
Answer: a
Explanation: size_t strcspn(const char *str1, const char *str2) is used to calculate the length of the initial segment of str1, which consists entirely of characters not in str2.

52. What is the return value of strxfrm()?
a) length of the transformed string, not including the terminating null-character
b) length of the transformed string, including the terminating null-character
c) display the transformed string, not including the terminating null character
d) display the transformed string, not including the terminating null-character
Answer: a
Explanation: This function returns the length of the transformed string, not including the terminating null character.

53. Is there any function declared as strstr()?
a) true
b) false
Answer: a
Explanation: This function returns a pointer to the first occurrence in s1 of any of the entire sequence of characters specified in s2, or a null pointer if the sequence is not present in s1.
char *strstr(const char *s1, const char *s2)

54. The C library function _________ breaks string s1 into a series of tokens using the delimiter s2.
a) char *strtok(char *s1,const char *s2);
b) char *strtok(char *s2,const char *s1);
c) char *strstr(char *s1,const char *s2);
d) char *strstr(char *s2,const char *s1);
Answer: a
Explanation: The C library function char *strtok(char *s1, const char *s2) breaks string s1 into a series of tokens using the delimiter s2.

55. The______function returns a pointer to the first character of a token.
a) strstr()
b) strcpy()
c) strspn()
d) strtok()
Answer: d
Explanation: The strtok() function returns a pointer to the first character of a token, if there is no token then a null pointer is returned.

56. which of the following function returns a pointer to the located string or a null pointer if string is not found.
a) strtok()
b) strstr()
c) strspn()
d) strrchr()
Answer: b
Explanation: The strstr() function is used to return a pointer to the located string, or if string is not found a null pointer is returned.
advertisement

57. Which of the given function is used to return a pointer to the located character?
a) strrchr()
b) strxfrm()
c) memchar()
d) strchar()
Answer: d
Explanation: The strchr() function is used to return a pointer to the located character if character does not occur then a null pointer is returned.

58. The strpbrk() function is used to return a pointer to the character, or a null pointer if no character from s2 occurs in s1.
a) true
b) false
Answer: a
Explanation: char *strpbrk(const char *s1,const char *s2);
The first occurrence in the string s1 of any character from the string s2 is done by strpbrk().

59. What will be the output of the following C code?
const char str1[] = “abcdef”;
const char str2[] = “fgha”;
char *mat;
mat= strpbrk(str1, str2);
if(mat)
printf(“First matching character: %c\n”, *mat);
else
printf(“Character not found”);
a) g
b) a
c) h
d) f
Answer: d
Explanation: The strpbrk() function is used to locate the first occurrence in the string str1 of any character from the string str2.

60. What will be the output of the following C code?

char str1[] = “Helloworld “;
char str2[] = “Hello”;
len = strspn(str1, str2);
printf(“Length of initial segment matching %d\n”, len );
a) 6
b) 5
c) 4
d) no match
Answer: b
Explanation: The length of the maximum initial segment of the string str1 which consists entirely of characters from the string str2 is computed by strspn().

61. The______ function returns the number of characters that are present before the terminating null character.
a) strlength()
b) strlen()
c) strlent()
d) strchr()
Answer: b
Explanation: The strlen() function is used to return the number of characters that are present before the terminating null character.size-t strlen(const char *s);The length of the string pointed to by s is computed by strlen().

62. What will be returned in the following C code?
size- t strlen(const char *s)
const char *sc;
for(sc = s; *sc!= ‘ \ O ‘ ; ++sc)
return(sc – s) ;
a) number of characters equal in sc
b) length of string s
c) doesn’t return any value
d) displays string s
Answer: b
Explanation: The strlen() function is used to return the length of the string s.

63. The function strsp() is the complement of strcspn().
a) true
b) false
Answer: a
Explanation: Both strcspn() and strpbrk() perform the same function. Only strspn() the return values differ. The function strspn() is the complement of strcspn() .

64. What will the following C code do?
char * strrchr(const char *s, int c )
char ch = c;
char *sc;
for(sc = NULL; ; ++s)
if(*s == ch)
SC = 9;
i f (*s ==’\O’ )
return (( char *) s);
a) find last occurrence of c in char s[ ].
b) find first occurrence of c in char s[ ].
c) find the current location of c in char s[ ].
d) There is error in the given code
Answer: a
Explanation:The strrchr() function locates the last occurrence of c (converted to a char) in the string pointed to by s. String contains null character as a terminating part of it.

65. This function offers the quickest way to determine whether two character sequences of the same known length match character for the character up to and including any null character in both.
a) strcmp()
b) memcmp()
c) strncmp()
d) no such function
Answer: c
Explanation: The strncmp() function is used to compare not more than n characters (characters that follow a null character are not compared) from the array pointed to by one, to the array pointed to by other.

66. What will be the output of the following C code?
char str1[15];
char str2[15];
int mat;
strcpy(str1, “abcdef”);
strcpy(str2, “ABCDEF”);
mat= strncmp(str1, str2, 4);
if(mat< 0)
printf(“str1 is not greater than str2”);
else if(mat> 0)
printf(“str2 is is not greater than str1”);
else
printf(“both are equal”);
a) str1 is not greater than str2
b) str2 is not greater than str1
c) both are equal
d) error in given code
Answer: b
Explanation: The C library function int strncmp(const char *str1, const char *str2, size_t n) is used to compare at most the first n bytes of str1 and str2.

67. What will be the output of the following C code?
void *memset(void *c, int c, size-t n)
unsigned char ch = c;
unsigned char *su;
for (su = s; 0 < n; ++su, –n)
<br>
*su = ch;
<br>
a) store c throughout unsigned char s[n]
b) store c throughout signed char s[n]
c) find first occurrence of c in s[n]
d) find last occurrence of c in s[n]
Answer: a
Explanation: This is the safe way to store the same value throughout a contiguous sequence of elements in a character array.

68. Use_______to determine the null-terminated message string that corresponds to the error code errcode.
a) strerror()
b) strstr()
c) strxfrm()
d) memset()
Answer: a
Explanation: Use strerror (errcode) to determine the null-terminated message string that corresponds to the error code errcode.

69. What will be the output of the following C code?
const char str1[10]=”Helloworld”;
const char str2[10] = “world”;
char *mat;
mat = strstr(str1, str2);
printf(“The substring is:%s\n”, mat);
a) The substring is:world
b) The substring is:Hello
c) The substring is:Helloworld
d) error in the code
Answer: a
Explanation: The C library function char *strstr(const char *str1, const char *str2) is used to find the first occurrence of the substring str2 in the string str1.The terminating ‘\0’ characters are not compared.

70. void *memcpy(void *dest, const void *src, size_t n) What does the following code do?
a) copies n characters from src to dest
b) copies n character from dest to src
c) transform n character from dest to src
d) transform n character from src to dest
Answer: a
Explanation: In the C library function memcpy() is used to copy n characters from memory area src to memory area dest.

71. What will the given C code do?
int memcmp(const void *str1, const void *str2, size_t n)
a) compares the first n bytes of str1 and str2
b) copies the first n bytes of str1 to str2
c) copies the first n bytes of str2 to str1
d) invalid function
Answer: a
Explanation: In the C library function int memcmp(const void *str1, const void *str2, size_t n)) is used to compare the first n bytes of memory area str1 and memory area str2.

72. The________function converts an uppercase letter to the corresponding lowercase letter.
a) islower()
b) isupper()
c) toupper()
d) tolower()
Answer: d
Explanation: If the argument is a character for which isupper() is true and islower() is true for another set of character, the tolower() function returns the corresponding character;otherwise, the argument is returned unchanged.

73. The toupper() function converts a ______ to the corresponding ______
a) uppercase, lowercase
b) lowercase, uppercase
c) binary, decimal
d) decimal, binary
Answer: b
Explanation: The toupper() function is used to convert a lowercase letter to the corresponding uppercase letter.
If the value is a character for which islower() is true and isupper () is true for another set of characters, the toupper() function returns the corresponding character, otherwise, the value is returned unchanged.

74. fgetc, getc, getchar are all declared in ________
a) stdio. h
b) ctype. h
c) assert. h
d) stdarg. h
Answer: a
Explanation: The functions getc, fgetc, getchar are all declared in stdio.h header file.

75. isalpha() function is used to detect characters both in uppercase and lowercase.
a) true
b) false
Answer: a
Explanation: isalpha() function is used to test for letters in the local alphabet. For the locale, the local alphabet consists of 26 English letters, in each of two cases.

76. What will be the output of the following C code?

int ch= ‘ ‘;
if(isgraph(ch))
printf(“ch = %c can be printed \n”,ch);
else
printf(“ch=%c cannot be printed \n”,ch);
a) ch = ‘ ‘ can be printed
b) ch = ‘ ‘ cannot be printed
c) compile error
d) run-time error
Answer: b
Explanation: void isgraph() function is used to check if the character has graphical representation. Graphical representations character are all those characters that can be printed except for whitespace characters, which is not considered as isgraph characters.

77. The C library function checks whether the passed character is printable.
a) isgraph()
b) isalpha()
c) isprint()
d) ispunct()
Answer: c
Explanation: int isprint(int c) function is used to check whether the passed character can be printed.A control character is not a printable character.

78. What will be the output of the following C code?
char ch[ ] = “0xC”;
if(isxdigit(ch[ ]))
printf(“ch = %s is hexadecimal character \n”,ch);
else
printf(“ch = %s is not hexadecimal character \n”,ch);
a) ch = 0xC is hexadecimal character
b) ch = 0xC is not hexadecimal character
c) compile error
d) run-time error
Answer: a
Explanation: The C library function isxdigit checks whether the passed character is a hexadecimal digit.

79. Which among the following option is the full set of character class Hexadecimal digits?
a) { 0 1 2 3 4 5 6 7 8 9 A B C D E F }
b) { 0 1 2 3 4 5 6 7 8 9 a b c d e f }
c) { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }
d) { 0 1 2 3 4 5 6 7 8 9}
Answer: c
Explanation: digit or one of the first letters of the alphabet in either case, ‘a’ through ‘f’ and ‘A’ through ‘F’ is contained in the character class Hexadecimal digits.

80. What will be the output of the following C code?
int i = 0;
char c;
char str[ ] = “Little Star”;
while(str[i])
{
putchar (toupper(str[i]));
i++;
}
a) little star
b) lITTLE sTAR
c) LITTLE STAR
d) Little Star
Answer: c
Explanation: The C library function toupper converts the lowercase letter to uppercase.

81. What will be the output of the following C code?
int ch = ‘\t’;
if(isprint(ch))
printf(“ch = |%c| printable \n”, ch);
else
printf(“ch= |%c| not printable \n”,ch);
a) ch = |\t| printable
b) ch = |\t| not printable
c) ch = | | printable
d) ch = | | not printable
Answer: d
Explanation: isprint() function is used to check whether the passed character is printable. A control character is not a printable character.

Module 5

1. Which of the following are themselves a collection of different data types?
a) string
b) structures
c) char
d) all of the mentioned
Answer: b
Explanation: None.

2. User-defined data type can be derived by___________
a) struct
b) enum
c) typedef
d) all of the mentioned
Answer: d
Explanation: None.

3. Which operator connects the structure name to its member name?
a) –
b) <-
c) .
d) Both <- and .
Answer: c
Explanation: None.

4. Which of the following cannot be a structure member?
a) Another structure
b) Function
c) Array
d) None of the mentioned
Answer: b
Explanation: None.

5. Which of the following structure declaration will throw an error?
a)struct temp{}s;
main(){}
b)struct temp{};
struct temp s;
main(){}
c)struct temp s;
struct temp{};
main(){}
d) None of the mentioned
Answer: d
Explanation: None.

6. What will be the output of the following C code?

#include <stdio.h>
struct student
{
int no;
char name[20];
}
void main()
{
struct student s;
s.no = 8;
printf(“hello”);
}
a) Compile time error
b) Nothing
c) hello
d) Varies
Answer: a
Explanation: None.

7. What will be the output of the following C code?

#include <stdio.h>
struct student
{
int no = 5;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf(“hello”);
}
a) Nothing
b) Compile time error
c) hello
d) Varies
Answer: b
Explanation: None.

8. What will be the output of the following C code?

#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.no = 8;
printf(“hello”);
}
a) Nothing
b) hello
c) Compile time error
d) Varies
Answer: c
Explanation: None.

9. What will be the output of the following C code?

#include <stdio.h>
void main()
{
struct student
{
int no;
char name[20];
};
struct student s;
s.no = 8;
printf(“%d”, s.no);
}
a) Nothing
b) Compile time error
c) Junk
d) 8
Answer: d
Explanation: None.

10. Can the following C code be compiled successfully?

#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .f = 3, .k = 1};
printf(“%f\n”, x.f);
}
a) Yes
b) No
c) Depends on the standard
d) Depends on the platform
Answer: c
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
void main()
{
struct student
{
int no;
char name[20];
};
struct student s;
no = 8;
printf(“%d”, no);
}
a) Nothing
b) Compile time error
c) Junk
d) 8
Answer: b
Explanation: None.

12. How many bytes in memory taken by the following C structure?

#include <stdio.h>
struct test
{
int k;
char c;
};
a) Multiple of integer size
b) integer size+character size
c) Depends on the platform
d) Multiple of word size
Answer: a
Explanation: None.

13. What will be the output of the following C code?

#include <stdio.h>
struct
{
int k;
char c;
};
int main()
{
struct p;
p.k = 10;
printf(“%d\n”, p.k);
}
a) Compile time error
b) 10
c) Undefined behaviour
d) Segmentation fault
Answer: a
Explanation: None.

14. What will be the output of the following C code?

#include <stdio.h>
struct
{
int k;
char c;
} p;
int p = 10;
int main()
{
p.k = 10;
printf(“%d %d\n”, p.k, p);
}
a) Compile time error
b) 10 10
c) Depends on the standard
d) Depends on the compiler
Answer: a
Explanation: None.

15. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int k;
char c;
};
int p = 10;
int main()
{
struct p x;
x.k = 10;
printf(“%d %d\n”, x.k, p);
}
a) Compile time error
b) 10 10
c) Depends on the standard
d) Depends on the compiler
Answer: b
Explanation: None.

16. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int p = 10;
int main()
{
struct p x = {1, 97};
printf(“%f %d\n”, x.f, p);
}
a) Compile time error
b) 0.000000 10
c) Somegarbage value 10
d) 0 10
Answer: b
Explanation: None.

17. What will be the output of the following C code according to C99 standard?

#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .f = 3, .k = 1};
printf(“%f\n”, x.f);
}
a) 3.000000
b) Compile time error
c) Undefined behaviour
d) 1.000000
Answer: a
Explanation: None.

18. What will be the output of the following C code according to C99 standard?

#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .k = 1, 3};
printf(“%f \n”, x.f);
}
a) 3.000000
b) 0.000000
c) Compile time error
d) Undefined behaviour
Answer: b
Explanation: None.

19. What will be the output of the following C code according to C99 standard?

#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97};
printf(“%f\n”, x.f);
}
a) 0.000000
b) Somegarbagevalue
c) Compile time error
d) None of the mentioned
Answer: a
Explanation: None.

20. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
struct student s;
struct student fun(void)
{
s.name = “newton”;
printf(“%s\n”, s.name);
s.name = “alan”;
return s;
}
void main()
{
struct student m = fun();
printf(“%s\n”, m.name);
m.name = “turing”;
printf(“%s\n”, s.name);
}
a) newton alan alan
b) alan newton alan
c) alan alan newton
d) compile time error
Answer: a
Explanation: None.

21. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
void main()
{
struct student s, m;
s.name = “st”;
m = s;
printf(“%s%s”, s.name, m.name);
}
a) Compile time error
b) Nothing
c) Junk values
d) st st
Answer: d
Explanation: None.

22. Which of the following return-type cannot be used for a function in C?
a) char *
b) struct
c) void
d) none of the mentioned
Answer: d
Explanation: None.

23. What will be the output of the following C code?

#include <stdio.h>
struct temp
{
int a;
} s;
void func(struct temp s)
{
s.a = 10;
printf(“%d\t”, s.a);
}
main()
{
func(s);
printf(“%d\t”, s.a);
}
a) 10 (Garbage Value)
b) 0 10
c) 10 0
d) (Garbage Value) 10
Answer: c
Explanation: None.

24. Which of the following is not possible under any scenario?
a) s1 = &s2;
b) s1 = s2;
c) (*s1).number = 10;
d) None of the mentioned
Answer: d
Explanation: None.

25. Which of the following operation is illegal in structures?
a) Typecasting of structure
b) Pointer to a variable of the same structure
c) Dynamic allocation of memory for structure
d) All of the mentioned
Answer: a
Explanation: None.

26. Presence of code like “s.t.b = 10” indicates __________
a) Syntax Error
b) Structure
c) double data type
d) An ordinary variable name
Answer: b
Explanation: None.

27. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
struct student fun(void)
{
struct student s;
s.name = “alan”;
return s;
}
void main()
{
struct student m = fun();
s.name = “turing”;
printf(“%s”, m.name);
}
a) alan
b) Turing
c) Compile time error
d) Nothing
Answer: c
Explanation: None.

28. The correct syntax to access the member of the ith structure in the array of structures is?
Assuming: struct temp
{
int b;
}s[50];
a) s.b.[i];
b) s.[i].b;
c) s.b[i];
d) s[i].b;
Answer: d
Explanation: None.

29. Comment on the output of the following C code.

#include <stdio.h>
struct temp
{
int a;
int b;
int c;
};
main()
{
struct temp p[] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
}
a) No Compile time error, generates an array of structure of size 3
b) No Compile time error, generates an array of structure of size 9
c) Compile time error, illegal declaration of a multidimensional array
d) Compile time error, illegal assignment to members of structure
Answer: a
Explanation: None.

30. Which of the following uses structure?
a) Array of structures
b) Linked Lists
c) Binary Tree
d) All of the mentioned
Answer: d
Explanation: None.

31. What is the correct syntax to declare a function foo() which receives an array of structure in function?
a) void foo(struct *var);
b) void foo(struct *var[]);
c) void foo(struct var);
d) none of the mentioned
Answer: a
Explanation: None.

32. What will be the output of the following C code? (Assuming size of int be 4)

#include <stdio.h>
struct temp
{
int a;
int b;
int c;
} p[] = {0};
main()
{
printf(“%d”, sizeof(p));
}
a) 4
b) 12
c) 16
d) Can’t be estimated due to ambiguous initialization of array
Answer: b
Explanation: None.

33. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
struct student s[2];
void main()
{
s[0].name = “alan”;
s[1] = s[0];
printf(“%s%s”, s[0].name, s[1].name);
s[1].name = “turing”;
printf(“%s%s”, s[0].name, s[1].name);
}
a) alan alan alan turing
b) alan alan turing turing
c) alan turing alan turing
d) run time error
Answer: a
Explanation: None.

34. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
struct student s[2], r[2];
void main()
{
s[0].name = “alan”;
s[1] = s[0];
r = s;
printf(“%s%s”, r[0].name, r[1].name);
}
a) alan alan
b) Compile time error
c) Varies
d) Nothing
Answer: b
Explanation: None.

35. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *name;
};
void main()
{
struct student s[2], r[2];
s[1] = s[0] = “alan”;
printf(“%s%s”, s[0].name, s[1].name);
}
a) alan alan
b) Nothing
c) Compile time error
d) Varies
Answer: c
Explanation: None.

36. What will be the output of the following C code?

#include <stdio.h>
struct student
{
};
void main()
{
struct student s[2];
printf(“%d”, sizeof(s));
}
a) 2
b) 4
c) 8
d) 0
Answer: d
Explanation: None.

37. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 3);
if (x == sizeof(int) + sizeof(char))
printf(“%d\n”, ptr1->x);
else
printf(“falsen”);
}
a) Compile time error
b) 1
c) Undefined behaviour
d) false
Answer: d
Explanation: None.

38. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / sizeof(ptr1));
if (x == 1)
printf(“%d\n”, ptr1->x);
else
printf(“false\n”);
}
a) Compile time error
b) 1
c) false
d) Undefined behaviour
Answer: c
Explanation: None.

39. What will be the output of the following C code?
#include <stdio.h>
struct p
{
int x;
char y;
};
typedef struct p* q*;
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
q ptr1 = p1;
printf(“%d\n”, ptr1->x);
}
a) Compile time error
b) 1
c) Undefined behaviour
d) Segmentation fault
Answer: a
Explanation: None.

40. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int x;
char y;
};
void foo(struct p* );
int main()
{
typedef struct p* q;
struct p p1[] = {1, 92, 3, 94, 5, 96};
foo(p1);
}
void foo(struct p* p1)
{
q ptr1 = p1;
printf(“%d\n”, ptr1->x);
}
a) Compile time error
b) 1
c) Segmentation fault
d) Undefined behaviour
Answer: a
Explanation: None.

41. Which of the following is an incorrect syntax for pointer to structure?

(Assuming struct temp{int b;}*my_struct;)
a) *my_struct.b = 10;
b) (*my_struct).b = 10;
c) my_struct->b = 10;
d) Both *my_struct.b = 10; and (*my_struct).b = 10;
Answer: a
Explanation: None.

42. Which of the following is an incorrect syntax to pass by reference a member of a structure in a function?
(Assume: struct temp{int a;}s;)
a) func(&s.a);
b) func(&(s).a);
c) func(&(s.a));
d) none of the mentioned
Answer: d
Explanation: None.

43. Which of the following structure declaration doesn’t require pass-by-reference?
a)struct{int a;}s;
main(){}
b)struct temp{int a;};
main(){
struct temp s;
}
c)struct temp{int a;};
main(){}
struct temp s;
d) none of the mentioned
Answer: d
Explanation: None.

44. Which option is not possible for the following function call?
func(&s.a); //where s is a variable of type struct and a is the member of the struct.
a) Compiler can access entire structure from the function
b) Individual member’s address can be displayed in structure
c) Individual member can be passed by reference in a function
d) None of the mentioned
Answer: a
Explanation: None.

45. What will be the output of the following C code?

#include <stdio.h>
struct temp
{
int a;
} s;
void change(struct temp);
main()
{
s.a = 10;
change(s);
printf(“%d\n”, s.a);
}
void change(struct temp s)
{
s.a = 1;
}
a) Output will be 1
b) Output will be 10
c) Output varies with machine
d) Compile time error
Answer: b
Explanation: None.

46. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int x;
int y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 5);
if (x == 3)
printf(“%d %d\n”, ptr1->x, (ptr1 + x – 1)->x);
else
printf(“false\n”);
}
a) Compile time error
b) 1 5
c) Undefined behaviour
d) false
Answer: d
Explanation: None.

47. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
struct student m;
s.c = m.c = “hi”;
m.point = &s;
(m.point)->c = “hey”;
printf(“%s\t%s\t”, s.c, m.c);
}
a) hey hi
b) hi hey
c) Run time error
d) hey hey
Answer: a
Explanation: None.

48. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
struct student m;
m.point = s;
(m.point)->c = “hey”;
printf(“%s”, s.c);
}
a) Nothing
b) Compile time error
c) hey
d) Varies
Answer: b
Explanation: None.

49. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *c;
struct student point;
};
void main()
{
struct student s;
s.c = “hello”;
printf(“%s”, s.c);
}
a) hello
b) Nothing
c) Varies
d) Compile time error
Answer: d
Explanation: None.

50. What will be the output of the following C code?
#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
printf(“%d”, sizeof(s));
}
a) 5
b) 9
c) 8
d) 16
Answer: c
Explanation: None.

51. What will be the output of the following C code?

#include <stdio.h>
struct student
{
char *c;
struct student *point;
};
void main()
{
struct student s;
struct student *m = &s;
printf(“%d”, sizeof(student));
}
a) Compile time error
b) 8
c) 5
d) 16
Answer: a
Explanation: None.

52. What will be the output of the following C code?

#include <stdio.h>
struct p
{
int x;
char y;
struct p *ptr;
};
int main()
{
struct p p = {1, 2, &p};
printf(“%d\n”, p.ptr->x);
return 0;
}
a) Compile time error
b) Undefined behaviour
c) 1
d) 2
Answer: c
Explanation: None.

53. What will be the output of the following C code?

#include <stdio.h>
typedef struct p *q;
struct p
{
int x;
char y;
q ptr;
};
int main()
{
struct p p = {1, 2, &p};
printf(“%d\n”, p.ptr->x);
return 0;
}
a) Compile time error
b) 1
c) Undefined behaviour
d) Address of p
Answer: b
Explanation: None.

54. Presence of loop in a linked list can be tested by ________
a) Traveling the list, if NULL is encountered no loop exists
b) Comparing the address of nodes by address of every other node
c) Comparing the the value stored in a node by a value in every other node
d) None of the mentioned
Answer: b
Explanation: None.

55. The size of a union is determined by the size of the __________
a) First member in the union
b) Last member in the union
c) Biggest member in the union
d) Sum of the sizes of all members
Answer: c
Explanation: None.

56. Which member of the union will be active after REF LINE in the following C code?
#include <stdio.h>
union temp
{
int a;
float b;
char c;
};
union temp s = {1,2.5,’A’}; //REF LINE
a) a
b) b
c) c
d) Such declaration are illegal
Answer: a
Explanation: None.

57. What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1)
#include <stdio.h>
union uTemp
{
double a;
int b[10];
char c;
}u;
a) 4
b) 8
c) 40
d) 80
Answer: c
Explanation: None.

58. What type of data is holded by variable u int in the following C code?

#include <stdio.h>
union u_tag
{
int ival;
float fval;
char *sval;
} u;
a) Will be large enough to hold the largest of the three types;
b) Will be large enough to hold the smallest of the three types;
c) Will be large enough to hold the all of the three types;
d) None of the mentioned
Answer: a
Explanation: None.

59. Members of a union are accessed as________________
a) union-name.member
b) union-pointer->member
c) both union-name.member & union-pointer->member
d) none of the mentioned
Answer: c
Explanation: None.

60. In the following C code, we can access the 1st character of the string sval by using _______

#include <stdio.h>
struct
{
char *name;
union
{
char *sval;
} u;
} symtab[10];
a) *symtab[i].u.sval
b) symtab[i].u.sval[0].
c) You cannot have union inside structure
d) Both *symtab[i].u.sval & symtab[i].u.sval[0].
Answer: d
Explanation: None.

61. What will be the output of the following C code (Assuming size of int and float is 4)?

#include <stdio.h>
union
{
int ival;
float fval;
} u;
void main()
{
printf(“%d”, sizeof(u));
}
a) 16
b) 8
c) 4
d) 32
Answer: c
Explanation: None.

62. What will be the output of the following C code?

#include <stdio.h>
union stu
{
int ival;
float fval;
};
void main()
{
union stu r;
r.ival = 5;
printf(“%d”, r.ival);
}
a) 9
b) Compile time error
c) 16
d) 5
Answer: d
Explanation: None.

63. What will be the output of the following C code?

#include <stdio.h>
typedef struct student
{
char *a;
}stu;
void main()
{
struct stu s;
s.a = “hi”;
printf(“%s”, s.a);
}
a) Compile time error
b) Varies
c) hi
d) h
Answer: a
Explanation: None.

64. What will be the output of the following C code?

#include <stdio.h>
typedef struct student
{
char *a;
}stu;
void main()
{
struct student s;
s.a = “hey”;
printf(“%s”, s.a);
}
a) Compile time error
b) Varies
c) he
d) hey
Answer: d
Explanation: None.

65. What will be the output of the following C code?

#include <stdio.h>
typedef int integer;
int main()
{
int i = 10, *ptr;
float f = 20;
integer j = i;
ptr = &j;
printf(“%d\n”, *ptr);
return 0;
}
a) Compile time error
b) Undefined behaviour
c) Depends on the standard
d) 10
Answer: d
Explanation: None.

67. What will be the output of the following C code?

#include <stdio.h>
int (*(x()))[2];
typedef int (*(*ptr)())[2] ptrfoo;
int main()
{
ptrfoo ptr1;
ptr1 = x;
ptr1();
return 0;
}
int (*(x()))[2]
{
int (*ary)[2] = malloc(sizeof*ary);
return &ary;
}
a) Compile time error
b) Nothing
c) Undefined behaviour
d) Depends on the standard
Answer: a
Explanation: None.

68. What will be the output of the following C code?

#include <stdio.h>
int *(*(x()))[2];
typedef int **(*ptrfoo)())[2];
int main()
{
ptrfoo ptr1;
ptr1 = x;
ptr1();
return 0;
}
int *(*(x()))[2]
{
int (*ary)[2] = malloc(sizeof * ary);
return &ary;
}
a) Compile time error
b) Nothing
c) Undefined behaviour
d) Depends on the standard
Answer: b
Explanation: None.

69. What will be the output of the following C code?

#include <stdio.h>
typedef struct p
{
int x, y;
};
int main()
{
p k1 = {1, 2};
printf(“%d\n”, k1.x);
}
a) Compile time error
b) 1
c) 0
d) Depends on the standard
Answer: a
Explanation: None.

70. What will be the output of the following C code?

#include <stdio.h>
typedef struct p
{
int x, y;
}k = {1, 2};
int main()
{
p k1 = k;
printf(“%d\n”, k1.x);
}
a) Compile time error
b) 1
c) 0
d) Depends on the standard
Answer: a
Explanation: None.

71. What will be the output of the following C code?
#include <stdio.h>
typedef struct p
{
int x, y;
}k;
int main()
{
struct p p = {1, 2};
k k1 = p;
printf(“%d\n”, k1.x);
}
a) Compile time error
b) 1
c) 0
d) Depends on the standard
Answer: b
Explanation: None.

Module 6

1. What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(” p “);
else
printf(“nullp”);
if (q)
printf(“q\n”);
else
printf(” nullq\n”);
}
a) nullp nullq
b) Depends on the compiler
c) x nullq where x can be p or nullp depending on the value of NULL
d) p q
Answer: a
Explanation: None.

2. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 10;
void *p = &i;
printf(“%d\n”, (int)*p);
return 0;
}
a) Compile time error
b) Segmentation fault/runtime crash
c) 10
d) Undefined behaviour
Answer: a
Explanation: None.

3. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 10;
void *p = &i;
printf(“%f\n”, *(float*)p);
return 0;
}
a) Compile time error
b) Undefined behaviour
c) 10
d) 0.000000
Answer: d
Explanation: None.

4. What will be the output of the following C code?

#include <stdio.h>
int *f();
int main()
{
int *p = f();
printf(“%d\n”, *p);
}
int *f()
{
int *j = (int*)malloc(sizeof(int));
*j = 10;
return j;
}
a) 10
b) Compile time error
c) Segmentation fault/runtime crash since pointer to local variable is returned
d) Undefined behaviour
Answer: a
Explanation: None.

5. What will be the output of the following C code?
#include <stdio.h>
int *f();
int main()
{
int *p = f();
printf(“%d\n”, *p);
}
int *f()
{
int j = 10;
return &j;
}
a) 10
b) Compile time error
c) Segmentation fault/runtime crash
d) Undefined behaviour
Answer: a
Explanation: We are returning address of a local variable which should not be done. In this specific instance, we are able to see the value of 10, which may not be the case if we call other functions before calling printf() in main().

6. Comment on the following pointer declaration.
int *ptr, p;
a) ptr is a pointer to integer, p is not
b) ptr and p, both are pointers to integer
c) ptr is a pointer to integer, p may or may not be
d) ptr and p both are not pointers to integer
Answer: a
Explanation: None.

7. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf(“%d,%d/n”, *ptr, a);
}
a) 10,10
b) 10,11
c) 11,10
d) 11,11
Answer: d
Explanation: None.

8. Comment on the following C statement.

const int *ptr;
a) You cannot change the value pointed by ptr
b) You cannot change the pointer ptr itself
c) You May or may not change the value pointed by ptr
d) You can change the pointer as well as the value pointed by it
Answer: a
Explanation: None.

9. Which is an indirection operator among the following?
a) &
b) *
c) ->
d) .
Answer: b
Explanation: None.

10. Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0;)?
a) int *ptr = &a;
b) int *ptr = &a – &a;
c) int *ptr = a – a;
d) All of the mentioned
Answer: a
Explanation: None.

11. What will be the output of the following C code?

#include <stdio.h>
int x = 0;
void main()
{
int *ptr = &x;
printf(“%p\n”, ptr);
x++;
printf(“%p\n “, ptr);
}
a) Same address
b) Different address
c) Compile time error
d) Varies
Answer: a
Explanation: None.

12. What will be the output of the following C code?

#include <stdio.h>
int x = 0;
void main()
{
int *const ptr = &x;
printf(“%p\n”, ptr);
ptr++;
printf(“%p\n “, ptr);
}
a) 0 1
b) Compile time error
c) 0xbfd605e8 0xbfd605ec
d) 0xbfd605e8 0xbfd605e8
Answer: b
Explanation: None.

13. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &x;
printf(“%p\n”, ptr);
ptr++;
printf(“%p\n “, ptr);
}
a) 0xbfd605e8 0xbfd605ec
b) 0xbfd605e8 0cbfd60520
c) 0xbfd605e8 0xbfd605e9
d) Run time error
Answer: a
Explanation: None.

14. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &5;
printf(“%p\n”, ptr);
}
a) 5
b) Address of 5
c) Nothing
d) Compile time error
Answer: d
Explanation: None.

15. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &x;
printf(“%d\n”, *ptr);
}
a) Address of x
b) Junk value
c) 0
d) Run time error
Answer: c
Explanation: None.

16. What will be the output of the following C code?

#include <stdio.h>
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf(“%d\n”, *p);
}
a) 10
b) Some garbage value
c) Compile time error
d) Segmentation fault/code crash
Answer: c
Explanation: None.

17. What will be the output of the following C code?
#include <stdio.h>
void foo(int*);
int main()
{
int i = 10, *p = &i;
foo(p++);
}
void foo(int *p)
{
printf(“%d\n”, *p);
}
a) 10
b) Some garbage value
c) Compile time error
d) Segmentation fault
Answer: a
Explanation: None.

18. What will be the output of the following C code?

#include <stdio.h>
void foo(float *);
int main()
{
int i = 10, *p = &i;
foo(&i);
}
void foo(float *p)
{
printf(“%f\n”, *p);
}
a) 10.000000
b) 0.000000
c) Compile time error
d) Undefined behaviour
Answer: b
Explanation: None.

19. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 97, *p = &i;
foo(&i);
printf(“%d “, *p);
}
void foo(int *p)
{
int j = 2;
p = &j;
printf(“%d “, *p);
}
a) 2 97
b) 2 2
c) Compile time error
d) Segmentation fault/code crash
Answer: a
Explanation: None.

20. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 97, *p = &i;
foo(&p);
printf(“%d “, *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf(“%d “, **p);
}
a) 2 2
b) 2 97
c) Undefined behaviour
d) Segmentation fault/code crash
Answer: a
Explanation: None.

21. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 11;
int *p = &i;
foo(&p);
printf(“%d “, *p);
}
void foo(int *const *p)
{
int j = 10;
*p = &j;
printf(“%d “, **p);
}
a) Compile time error
b) 10 10
c) Undefined behaviour
d) 10 11
Answer: a
Explanation: None.

22. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 10;
int *p = &i;
foo(&p);
printf(“%d “, *p);
printf(“%d “, *p);
}
void foo(int **const p)
{
int j = 11;
*p = &j;
printf(“%d “, **p);
}
a) 11 11 11
b) 11 11 Undefined-value
c) Compile time error
d) Segmentation fault/code-crash
Answer: b
Explanation: None.

23. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int i = 10;
int *const p = &i;
foo(&p);
printf(“%d\n”, *p);
}
void foo(int **p)
{
int j = 11;
*p = &j;
printf(“%d\n”, **p);
}
a) 11 11
b) Undefined behaviour
c) Compile time error
d) Segmentation fault/code-crash
Answer: a
Explanation: None.

24. Which of the following is the correct syntax to send an array as a parameter to function?
a) func(&array);
b) func(#array);
c) func(*array);
d) func(array[size]);
Answer: a
Explanation: None.

25. Which of the following can never be sent by call-by-value?
a) Variable
b) Array
c) Structures
d) Both Array and Structures
Answer: b
Explanation: None.

26. Which type of variables can have the same name in a different function?
a) Global variables
b) Static variables
c) Function arguments
d) Both static variables and Function arguments
Answer: d
Explanation: None.

27. Arguments that take input by user before running a program are called?
a) Main function arguments
b) Main arguments
c) Command-Line arguments
d) Parameterized arguments
Answer: c
Explanation: None.

28. What is the maximum number of arguments that can be passed in a single function?
a) 127
b) 253
c) 361
d) No limits in number of arguments
Answer: b
Explanation: None.

29. What will be the output of the following C code?
#include <stdio.h>
void m(int *p, int *q)
{
int temp = *p; *p = *q; *q = temp;
}
void main()
{
int a = 6, b = 5;
m(&a, &b);
printf(“%d %d\n”, a, b);
}
a) 5 6
b) 6 5
c) 5 5
d) 6 6
Answer: a
Explanation: None.

30. What will be the output of the following C code?

#include <stdio.h>
void m(int *p)
{
int i = 0;
for(i = 0;i < 5; i++)
printf(“%d\t”, p[i]);
}
void main()
{
int a[5] = {6, 5, 3};
m(&a);
}
a) 0 0 0 0 0
b) 6 5 3 0 0
c) Run time error
d) 6 5 3 junk junk
Answer: b
Explanation: None.

31. What will be the output of the following C code?
#include <stdio.h>
void m(int p, int q)
{
int temp = p;
p = q;
q = temp;
}
void main()
{
int a = 6, b = 5;
m(a, b);
printf(“%d %d\n”, a, b);
}
a) 5 6
b) 5 5
c) 6 5
d) 6 6
Answer: c
Explanation: None.

32. What will be the output of the following C code?

#include <stdio.h>
void m(int p, int q)
{
printf(“%d %d\n”, p, q);
}
void main()
{
int a = 6, b = 5;
m(a);
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
Answer: d
Explanation: None.

33. What will be the output of the following C code?

#include <stdio.h>
void m(int p)
{
printf(“%d\n”, p);
}
void main()
{
int a = 6, b = 5;
m(a, b);
printf(“%d %d\n”, a, b);
}
a) 6
b) 6 5
c) 6 junk value
d) Compile time error
Answer: d
Explanation: None.

34. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
printf(“%p\t%p”, p, a);
}
a) Same address is printed
b) Different address is printed
c) Compile time error
d) Nothing
Answer: a
Explanation: None.

35. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s = “hello”;
char *p = s;
printf(“%p\t%p”, p, s);
}
a) Different address is printed
b) Same address is printed
c) Run time error
d) Nothing
Answer: b
Explanation: None.

36. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, p[0], s[1]);
}
a) Run time error
b) h h
c) h e
d) h l
Answer: c
Explanation: None.

37. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, *(p + 3), s[1]);
}
a) h e
b) l l
c) l o
d) l e
Answer: d
Explanation: None.

38. What will be the output of the following C code?

#include <stdio.h>
void main()
{
char *s= “hello”;
char *p = s;
printf(“%c\t%c”, 1[p], s[1]);
}
a) h h
b) Run time error
c) l l
d) e e
Answer: d
Explanation: None.

39. What will be the output of the following C code?

#include <stdio.h>
void foo( int[] );
int main()
{
int ary[4] = {1, 2, 3, 4};
foo(ary);
printf(“%d “, ary[0]);
}
void foo(int p[4])
{
int i = 10;
p = &i;
printf(“%d “, p[0]);
}
a) 10 10
b) Compile time error
c) 10 1
d) Undefined behaviour
Answer: c
Explanation: None.

40. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf(“%d\n”, p[-2]);
}
a) 1
b) 2
c) Compile time error
d) Some garbage value
Answer: b
Explanation: None.

41. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf(“%d %d\n”, p[-2], ary[*p]);
}
a) 2 3
b) Compile time error
c) 2 4
d) 2 somegarbagevalue
Answer: d
Explanation: None.

42. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf(“%d%d%d\n”, k, *p, **m);
}
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Run time error
Answer: a
Explanation: None.

43. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf(“%d%d%d\n”, k, *p, **p);
}
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Compile time error
Answer: d
Explanation: None.

44. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf(“%d\n”, k);
}
a) 5
b) Compile time error
c) 6
d) Junk
Answer: c
Explanation: None.

45. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf(“%d”, (**r));
}
a) 1
b) Compile time error
c) Address of a
d) Junk value
Answer: b
Explanation: None.

46. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf(“%p %p”, *r, a);
}
a) Different address is printed
b) 1 2
c) Same address is printed
d) 1 1
Answer: c
Explanation: None.

47. How many number of pointer (*) does C have against a pointer variable declaration?
a) 7
b) 127
c) 255
d) No limits
Answer: d
Explanation: None.

48. What will be the output of the following C code?

#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
a) ptr1 points to a
b) ptr1 points to b
c) sptr points to ptr2
d) none of the mentioned
Answer: b
Explanation: None.

49. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf(“%p %p”, *r, a);
}
a) Different address is printed
b) 1 2
c) Same address is printed
d) 1 1
Answer: c
Explanation: None.

50. What substitution should be made to //-Ref such that ptr1 points to variable c in the following C code?

#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a;
int **sptr = &ptr1;
//-Ref
}
a) *sptr = &c;
b) **sptr = &c;
c) *ptr1 = &c;
d) none of the mentioned
Answer: a
Explanation: None.

51. Which of the following declaration will result in run-time error?
a) int **c = &c;
b) int **c = &*c;
c) int **c = **c;
d) none of the mentioned
Answer: d
Explanation: None.

52. Comment on the output of the following C code.

#include <stdio.h>
int main()
{
int a = 10;
int **c -= &&a;
}
a) You cannot apply any arithmetic operand to a pointer
b) We don’t have address of an address operator
c) We have address of an address operator
d) None of the mentioned
Answer: b
Explanation: None.

53. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf(“%d%d%d\n”, k, *p, **m);
}
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Compile time error
Answer: a
Explanation: None.

54. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf(“%d%d%d\n”, k, *p, **p);
}
a) 5 5 5
b) 5 5 junk value
c) 5 junk junk
d) Compile time error
Answer: d
Explanation: None.

55. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf(“%d\n”, k);
}
a) 5
b) Run time error
c) 6
d) Junk
Answer: c
Explanation: None.

56. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf(“%d”, (**r));
}
a) 1
b) Compile time error
c) Address of a
d) Junk value
Answer: b
Explanation: None.

57. What will be the output of the following C code?

#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int *function_pointer;
function_pointer = mul;
printf(“The product of three numbers is:%d”,
function_pointer(2, 3, 4));
}
a) The product of three numbers is:24
b) Compile time error
c) Nothing
d) Varies
Answer: b
Explanation: None.

58. What will be the output of the following C code?

#include <stdio.h>
int sub(int a, int b, int c)
{
return a – b – c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = &sub;
printf(“The difference of three numbers is:%d”,
(*function_pointer)(2, 3, 4));
}
a) The difference of three numbers is:1
b) Run time error
c) The difference of three numbers is:-5
d) Varies
Answer: c
Explanation: None.

59. One of the uses for function pointers in C is __________
a) Nothing
b) There are no function pointers in c
c) To invoke a function
d) To call a function defined at run-time
Answer: d
Explanation: None.

60. What will be the output of the following C code?

#include <stdio.h>
void f(int);
void (*foo)() = f;
int main(int argc, char *argv[])
{
foo(10);
return 0;
}
void f(int i)
{
printf(“%d\n”, i);
}
a) Compile time error
b) 10
c) Undefined behaviour
d) None of the mentioned
Answer: b
Explanation: None.

61. What will be the output of the following C code?

#include <stdio.h>
void f(int);
void (*foo)(void) = f;
int main(int argc, char *argv[])
{
foo(10);
return 0;
}
void f(int i)
{
printf(“%d\n”, i);
}
a) Compile time error
b) 10
c) Undefined behaviour
d) None of the mentioned
Answer: a
Explanation: None.

62. What will be the output of the following C code?

#include <stdio.h>
void f(int);
void (*foo)(float) = f;
int main()
{
foo(10);
}
void f(int i)
{
printf(“%d\n”, i);
}
a) Compile time error
b) 10
c) 10.000000
d) Undefined behaviour
Answer: d
Explanation: None.

63. What will be the output of the following C code?

#include <stdio.h>
void f(int (*x)(int));
int myfoo(int i);
int (*foo)(int) = myfoo;
int main()
{
f(foo(10));
}
void f(int (*i)(int))
{
i(11);
}
int myfoo(int i)
{
printf(“%d\n”, i);
return i;
}
a) Compile time error
b) Undefined behaviour
c) 10 11
d) 10 Segmentation fault
Answer: d
Explanation: None.

64. What will be the output of the following C code?

#include <stdio.h>
void f(int (*x)(int));
int myfoo(int);
int (*foo)() = myfoo;
int main()
{
f(foo);
}
void f(int(*i)(int ))
{
i(11);
}
int myfoo(int i)
{
printf(“%d\n”, i);
return i;
}
a) 10 11
b) 11
c) 10
d) Undefined behaviour
Answer: b
Explanation: None.

Prepare For Your Placements: https://lastmomenttuitions.com/courses/placement-preparation/

/ Youtube Channel: https://www.youtube.com/channel/UCGFNZxMqKLsqWERX_N2f08Q

Follow For Latest Updates, Study Tips & More Content!

/lastmomenttuition

Last Moment Tuitions

lastmomentdost