0% found this document useful (0 votes)
16 views37 pages

VND Openxmlformats-Officedocument Wordprocessingml Document&rendition 1

The document is a comprehensive overview of the C programming language, covering topics such as keywords, data types, decision making, arrays, functions, structures, unions, and pointers. It includes multiple-choice questions with answers to test knowledge on these subjects. Each unit provides essential concepts and syntax relevant to programming in C.

Uploaded by

suganthi s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views37 pages

VND Openxmlformats-Officedocument Wordprocessingml Document&rendition 1

The document is a comprehensive overview of the C programming language, covering topics such as keywords, data types, decision making, arrays, functions, structures, unions, and pointers. It includes multiple-choice questions with answers to test knowledge on these subjects. Each unit provides essential concepts and syntax relevant to programming in C.

Uploaded by

suganthi s
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Unit I: Overview of C

1. Which of the following is not a C keyword?


a) int
b) float
c) char
d) constant
Answer: d
2. What does a C program start with?
a) #include
b) main()
c) int
d) printf
Answer: b
3. In C, which operator is used for increment?
a) ++
b) --
c) +
d) +=
Answer: a
4. Which of the following data types has the largest size in C?
a) char
b) int
c) float
d) double
Answer: d
5. Which of the following is used for formatted output in C?
a) scanf()
b) printf()
c) getchar()
d) putchar()
Answer: b
6. Which is the correct way to declare a constant in C?
a) const int x = 5;
b) #define x 5
c) Both a and b
d) None of the above
Answer: c
7. Which of the following is a valid identifier in C?
a) 1stNum
b) num@1
c) _num1
d) double
Answer: c
8. What is the output of the following C program?

int x = 5, y = 3;
printf("%d", x + y);
a) 53
b) 8
c) 5
d) Error
Answer: b

9. Which of the following operators has the highest precedence in C?


a) *
b) +
c) -
d) /
Answer: a
10. What is the result of the following expression: 5 / 2?
a) 2
b) 2.5
c) 2.0
d) Error
Answer: a

Unit II: Decision Making

11. Which of the following is the correct syntax for an if statement in C?


a) if (condition) {}
b) if condition {}
c) if {} (condition)
d) if {} (condition)
Answer: a
12. What will the following code print?

int a = 5, b = 3;
if (a > b) {
printf("Greater");
} else {
printf("Smaller");
}

a) Greater
b) Smaller
c) Error
d) None of the above
Answer: a

13. Which loop is guaranteed to execute at least once?


a) for
b) while
c) do-while
d) None of the above
Answer: c
14. Which of the following is correct for the switch statement in C?
a) Switch can have multiple case statements
b) switch uses if conditions
c) switch is used only for integers
d) None of the above
Answer: a
15. Which of the following loops checks the condition after executing the loop body?
a) for
b) while
c) do-while
d) None of the above
Answer: c
16. What does the following code print?

int i = 0;
for (i = 0; i < 5; i++) {
if (i == 3) {
continue;
}
printf("%d ", i);
}

a) 0 1 2 3 4
b) 0 1 2 4
c) 1 2 3 4
d) 0 1 3 4
Answer: b

17. What is the purpose of the break statement in loops?


a) To exit the loop entirely
b) To skip the current iteration
c) To reset the loop counter
d) None of the above
Answer: a
18. Which statement is used to exit a loop early in C?
a) break
b) continue
c) exit
d) return
Answer: a
19. How can you avoid using multiple if statements to check multiple conditions in
C?
a) Use a switch statement
b) Use only one if statement
c) Use the goto statement
d) None of the above
Answer: a
20. Which of the following is an example of a nested if?
a) if (x > y) { if (x > z) {} }
b) if (x > y) else { if (x > z) {} }
c) if (x) { if (y) {} else {}}
d) All of the above
Answer: a
Unit III: Arrays and Functions

21. How do you declare a one-dimensional array in C?


a) int arr[5];
b) int arr{5};
c) int[5] arr;
d) None of the above
Answer: a
22. What is the size of an integer array of size 5, where each integer takes 4 bytes?
a) 5 bytes
b) 20 bytes
c) 4 bytes
d) 16 bytes
Answer: b
23. How can you access the third element of an array in C?
a) arr[2]
b) arr[3]
c) arr(2)
d) None of the above
Answer: a
24. Which function in C is used to find the length of a string?
a) length()
b) size()
c) strlen()
d) strlength()
Answer: c
25. Which of the following is correct for passing an array to a function?
a) Using array size
b) Using the array name only
c) Using a pointer
d) All of the above
Answer: d
26. How is a function declared in C?
a) return_type function_name(parameter_list);
b) function_name(return_type, parameter_list);
c) function(return_type, parameter_list);
d) None of the above
Answer: a
27. What is recursion in C?
a) A function calling itself
b) A function calling other functions
c) A function that returns an integer
d) A function that prints output
Answer: a
28. Which of the following is an example of a valid C function declaration?
a) int func(int a, float b);
b) void func(a, b);
c) int func(void);
d) None of the above
Answer: a
29. What is the function signature of a function returning an integer and accepting
two integers as arguments?
a) int func(int, int);
b) func(int, int) int;
c) func(int, int)
d) int func(int a, int b);
Answer: d
30. How do you pass an array by reference to a function?
a) By passing the array name
b) By passing a pointer to the array
c) Both a and b
d) None of the above
Answer: c

Unit IV: Structures and Unions

31. What is the syntax to define a structure in C?


a) struct { type name; }
b) structure { type name; }
c) struct name { type name; };
d) struct name { type name };
Answer: c
32. Which of the following is the correct way to initialize a structure?
a) struct Student { int age; } s1 = {20};
b) struct Student { int age; } = {20};
c) struct Student { int age = 20; } s1;
d) None of the above
Answer: a
33. What is the size of a structure variable in C?
a) The size of the structure
b) The sum of the sizes of its members
c) The size of the largest member
d) The size of the structure plus padding
Answer: d
34. What is a union in C?
a) A data structure that holds multiple variables of the same type
b) A data structure that can hold multiple variables of different types but shares the
same memory space
c) A method to access a structure
d) None of the above
Answer: b
35. What is the primary difference between structures and unions in C?
a) Structures store all members together in memory; unions share memory space for
all members.
b) Structures share memory space; unions store members together.
c) Structures are faster than unions.
d) Unions can hold only one type of data.
Answer: a
36. Which of the following is the correct syntax for defining a union?
a) union { type name; };
b) union name { type name; };
c) union name { name; type };
d) union type { name; };
Answer: b
37. What is a key feature of a union?
a) It allocates memory for all members simultaneously.
b) It uses memory only for the largest member.
c) It allows all members to be accessed simultaneously.
d) It stores members sequentially.
Answer: b
38. Which of the following is true about structures in C?
a) All members are accessed sequentially.
b) All members share the same memory location.
c) Members can have different data types.
d) None of the above.
Answer: c
39. In C, which preprocessor directive is used to define a macro?
a) #include
b) #define
c) #macro
d) #preprocess
Answer: b
40. What is the use of file inclusion in C?
a) It includes external files for code reusability.
b) It allows the program to link to an external library.
c) Both a and b
d) None of the above
Answer: c

Unit V: Pointers

41. What is a pointer in C?


a) A variable that holds the address of another variable
b) A function that manipulates memory
c) A type of variable for storing values
d) A special data type
Answer: a
42. How is a pointer declared in C?
a) int *ptr;
b) int ptr;
c) ptr *int;
d) None of the above
Answer: a
43. What will the following code print?

int a = 5;
int *ptr = &a;
printf("%d", *ptr);
a) 5
b) 0
c) Address of a
d) Error
Answer: a

44. Which operator is used to access the value stored in the memory address a
pointer is pointing to?
a) *
b) &
c) ->
d) @
Answer: a
45. What does the following code do?

int a = 10, b = 20;


int *ptr1 = &a, *ptr2 = &b;
*ptr1 = *ptr2;

a) Assigns the value of a to b


b) Assigns the value of b to a
c) Both a and b
d) None of the above
Answer: b

46. What is the purpose of the & operator in C?


a) It gets the value of a variable
b) It gets the address of a variable
c) It increases the pointer value
d) None of the above
Answer: b
47. Which of the following is true about pointers and arrays in C?
a) Arrays and pointers are the same thing.
b) The name of an array is a pointer to its first element.
c) Pointers cannot be used with arrays.
d) None of the above.
Answer: b
48. How do you access a structure member using a pointer?
a) Using dot notation
b) Using arrow (->) notation
c) Both a and b
d) None of the above
Answer: b
49. What does the following code do?

int x = 10;
int *ptr = &x;
ptr++;
printf("%p", ptr);
a) It increments the pointer by 1 byte.
b) It increments the pointer by the size of an integer.
c) It points to x.
d) It causes a segmentation fault.
Answer: b

50. What is a void pointer in C?


a) A pointer that cannot store an address
b) A pointer that points to a memory location but has no type
c) A pointer to NULL
d) A pointer to a variable of type void
Answer: b
51. Which of the following operations is not allowed with pointers?
a) Pointer increment
b) Pointer comparison
c) Pointer subtraction
d) Pointer multiplication
Answer: d
52. Which of the following is the correct way to initialize a pointer?
a) int *ptr = 10;
b) int *ptr = &10;
c) int ptr = 10;
d) None of the above
Answer: b
53. What does the following code do?

int x = 5;
int *ptr = &x;
*ptr = 10;
printf("%d", x);

a) Prints 10
b) Prints 5
c) Prints address of x
d) Causes a runtime error
Answer: a

54. What is pointer arithmetic in C?


a) Operations on memory addresses such as increment and decrement
b) Operations on values of the variables pointed to
c) Both a and b
d) None of the above
Answer: a
55. Which operator is used to get the address of a variable in C?
a) &
b) *
c) ->
d) @
Answer: a
56. Which of the following is used to comment a single line in C?
a) //
b) /* */
c) #comment
d) ;
Answer: a
57. Which of the following C data types can hold the largest range of values?
a) int
b) char
c) long
d) double
Answer: d
58. What will the following program output?

printf("%c", 'A' + 1);

a) B
b) 66
c) A1
d) Error
Answer: a

59. What is the correct syntax for defining a constant in C?


a) const constant_name = value;
b) #define constant_name value
c) constant constant_name = value;
d) None of the above
Answer: b
60. Which of the following operators is used to assign a value to a variable?
a) ==
b) =
c) :
d) ->
Answer: b

61. Which of the following is true about the switch statement?


a) It can handle both integer and float values.
b) It compares the value of an expression against several case values.
c) The default case is optional.
d) All of the above
Answer: d
62. Which statement is used to skip an iteration in a loop?
a) break
b) continue
c) exit
d) return
Answer: b
63. What is the output of the following code?

int i = 0;
while (i < 5) {
if (i == 3) {
break;
}
printf("%d ", i);
i++;
}

a) 0 1 2 3 4
b) 0 1 2
c) 1 2 3 4
d) 0 1 2 3
Answer: b

64. In which of the following cases would a goto statement be useful?


a) When you want to jump to the beginning of the program
b) When you need to exit from multiple nested loops
c) When skipping specific code sections
d) None of the above
Answer: b
65. Which of the following is the correct way to write a while loop in C?
a) while (condition) {}
b) while {} condition
c) while (condition) do {}
d) while condition {}
Answer: a

66. What is the default value of an uninitialized local variable in C?


a) 0
b) Garbage value
c) NULL
d) Undefined
Answer: b
67. How can you pass an array of integers to a function in C?
a) int arr[]
b) int *arr
c) Both a and b
d) None of the above
Answer: c
68. Which of the following functions can be used to copy one string to another in C?
a) strcpy()
b) strcat()
c) strcmp()
d) strcopy()
Answer: a
69. What does the following code do?

int arr[] = {1, 2, 3, 4};


printf("%d", arr[2]);

a) Prints 1
b) Prints 2
c) Prints 3
d) Prints 4
Answer: c

70. What is the return type of a function that does not return any value in C?
a) int
b) void
c) char
d) None of the above
Answer: b

Unit IV: Structures and Unions (Continued)

71. Which of the following is true for the members of a structure?


a) Members of a structure can have different data types.
b) All members of a structure must be integers.
c) All members of a structure must have the same data type.
d) Members of a structure are always initialized to zero.
Answer: a
72. Which of the following is correct for initializing an array of structures?
a) struct Student { int age; } students[] = {{20}, {25}};
b) struct Student { int age; } students[] = {{age = 20}, {age = 25}};
c) struct Student { int age; } students[] = {age = 20, 25};
d) None of the above
Answer: a
73. Which of the following is used to access a member of a structure through a
pointer in C?
a) ->
b) .
c) &
d) Both a and b
Answer: a
74. What is the primary advantage of using a union over a structure in C?
a) Unions use less memory by storing one member at a time
b) Structures allow better memory management
c) Unions allow for more complex data types
d) None of the above
Answer: a
75. Which of the following preprocessor directives is used to include header files in
C?
a) #include
b) #define
c) #import
d) #require
Answer: a

Unit I: Set Theory (10 hrs)


1. What is the cardinality of the set A = {1, 2, 3}?
a) 2
b) 3
c) 4
d) 5
Answer: b
2. Which of the following is a subset of {1, 2, 3}?
a) {1, 4}
b) {2, 3}
c) {4, 5}
d) {1, 2, 3, 4}
Answer: b
3. What is the universal set in the context of sets A = {1, 2}, B = {2, 3}?
a) {1, 2, 3}
b) {1, 2, 4}
c) {1, 3}
d) {2, 3}
Answer: a
4. Which of the following is the power set of A = {1, 2}?
a) {{1}, {2}}
b) {1, 2}
c) {{}, {1}, {2}, {1, 2}}
d) {1, 2, 3}
Answer: c
5. The Cartesian product of sets A = {1, 2} and B = {x, y} is:
a) {(1, x), (1, y), (2, x), (2, y)}
b) {(1, 2), (x, y)}
c) {(1, y), (2, x)}
d) {(x, 1), (y, 2)}
Answer: a

Unit II: Relations and Functions (8 hrs)

6. A relation R on a set A is a:
a) Subset of A
b) Set of ordered pairs
c) Set of elements
d) Power set of A
Answer: b
7. Which of the following is an equivalence relation?
a) Reflexive
b) Symmetric
c) Transitive
d) All of the above
Answer: d
8. What is the domain of the function f(x) = x + 2?
a) Real numbers
b) Natural numbers
c) Complex numbers
d) None of the above
Answer: a
9. The inverse of a function is defined if the function is:
a) Surjective
b) Injective
c) Bijective
d) None of the above
Answer: c
10. Which of the following defines a function?
a) A set of ordered pairs
b) A mapping from elements of one set to another set
c) A relationship between elements of two sets
d) All of the above
Answer: d

Unit III: Mathematical Logic (12 hrs; T-3 hrs)

11. A proposition is:


a) A declarative statement
b) A question
c) An equation
d) An inequality
Answer: a

a) p ∧ ¬p
12. Which of the following is a tautology?

b) p ∨ ¬p
c) p ∧ p
d) p ∨ p

13. The truth table for (p ∧ q) ∨ r is:


Answer: b

a) Same as p ∧ q
b) Same as p ∨ q
c) Same as p ∨ q ∨ r
d) None of the above
Answer: c
14. The contrapositive of the statement "If p, then q" is:
a) If q, then p
b) If not p, then not q
c) If not q, then not p
d) None of the above
Answer: c
15. Which of the following is an example of a logical operator?
a) AND
b) OR
c) NOT
d) All of the above
Answer: d
16. A formula in normal form is:
a) A formula that can be expressed in terms of conjunctions and disjunctions
b) A formula that has no logical equivalence
c) A formula in the form of an implication
d) None of the above
Answer: a

a) p ∧ ¬p
17. Which of the following is a contradiction?

b) p ∨ ¬p
c) p → p
d) None of the above

18. The logical operator ∧ stands for:


Answer: a

a) OR
b) AND
c) NOT
d) IMPLIES

19. Which of the following is the negation of the statement "p ∨ q"?
Answer: b

a) ¬p ∨ q
b) ¬p ∧ ¬q
c) p ∧ q
d) None of the above

20. The truth value of (p ∧ q) ∨ (¬p ∧ r) when p = true, q = false, and r = true is:
Answer: b

a) true
b) false
c) undefined
d) None of the above
Answer: a

Unit IV: Matrix Algebra (12 hrs; T-3 hrs)

21. A square matrix has:


a) Equal number of rows and columns
b) Equal number of rows and columns, but with zero elements
c) More rows than columns
d) More columns than rows
Answer: a
22. The sum of two matrices is only defined if the matrices have the same:
a) Order
b) Determinant
c) Inverse
d) Eigenvalues
Answer: a
23. The identity matrix for a 3x3 matrix is:
a) All elements are 1
b) All elements are 0
c) Diagonal elements are 1, and other elements are 0
d) Diagonal elements are 0, and other elements are 1
Answer: c
24. The determinant of a 2x2 matrix [a, b; c, d] is:
a) ad + bc
b) ad - bc
c) ab - cd
d) ac - bd
Answer: b
25. Which of the following matrices is symmetric?
a) [1, 2; 3, 4]
b) [1, 0; 0, 1]
c) [1, 2; 2, 1]
d) [1, 1; 1, 1]
Answer: c
26. The transpose of a matrix A is:
a) A matrix formed by changing the rows into columns and columns into rows
b) A matrix formed by multiplying A by itself
c) A matrix formed by inverting A
d) A matrix with the same size as A
Answer: a
27. Which of the following is not a type of matrix?
a) Row matrix
b) Column matrix
c) Null matrix
d) Singular matrix
Answer: d
28. A complex matrix contains:
a) Real numbers
b) Imaginary numbers
c) Complex numbers
d) Both real and imaginary numbers
Answer: c
29. Which of the following is the conjugate of a complex matrix?
a) A matrix where the real parts are negated
b) A matrix where the imaginary parts are negated
c) A matrix with real parts and negated imaginary parts
d) A matrix with all entries being 1
Answer: c
30. If A is a 3x3 matrix and the determinant of A is 0, A is considered:
a) Invertible
b) Singular
c) Symmetric
d) None of the above
Answer: b

Unit V: Adjoint Matrix (8 hrs; T-4 hrs)


31. The adjoint of a matrix A is:
a) The inverse of A
b) The transpose of A
c) The cofactor matrix of A
d) The determinant of A
Answer: c
32. A matrix is non-singular if and only if its adjoint exists and:
a) Its determinant is zero
b) Its determinant is non-zero
c) It is a square matrix
d) It is a diagonal matrix
Answer: b
33. The inverse of a matrix A is given by:
a) (det(A)) * adj(A)
b) adj(A) / det(A)
c) adj(A) * det(A)
d) None of the above
Answer: b
34. Which of the following is true for an adjoint matrix?
a) The adjoint of a matrix is always a square matrix
b) The adjoint of a matrix is the same as its transpose
c) The adjoint of a matrix always has real entries
d) The adjoint of a matrix is always invertible
Answer: a
35. If A is a square matrix, the inverse of A is calculated as:
a) 1/det(A) * adj(A)
b) det(A) * adj(A)
c) adj(A) * A
d) None of the above
Answer: a

Unit I: Set Theory

36. Which of the following sets is an example of a proper subset?


a) {1, 2, 3}
b) {2, 3}
c) {1, 2, 3, 4}
d) {1}
Answer: b
37. Which of the following operations between two sets A and B results in a set
containing only elements that are in both sets?
a) Union
b) Difference
c) Intersection
d) Complement
Answer: c
38. What is the Cartesian product of two sets A = {1, 2} and B = {a, b, c}?
a) {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
b) {(a, 1), (b, 1), (c, 1), (a, 2), (b, 2), (c, 2)}
c) {(1, a), (2, b), (3, c)}
d) {(a, b), (b, c), (c, a)}
Answer: a
39. If A = {x, y, z}, what is the power set of A?
a) {x, y, z}
b) {{}, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}
c) {{x, y, z}}
d) {{x}, {y, z}}
Answer: b

a) A ∪ A' = Universal set


40. Which of the following is true about the complement of a set A?

c) A ∪ A' = Empty set


b) A ∩ A' = Universal set

d) None of the above


Answer: a

Unit II: Relations and Functions

41. Which of the following is an example of an equivalence relation?


a) x < y
b) x = y
c) x ≤ y
d) None of the above

42. If f(x) = x², what is the range of the function for x ∈ {1, 2, 3}?
Answer: b

a) {1, 4, 9}
b) {1, 2, 3}
c) {0, 1, 4}
d) {1, 4, 8}
Answer: a
43. What is the domain of the function f(x) = 1/x?
a) All real numbers except 0
b) All positive real numbers
c) All real numbers
d) All non-negative real numbers
Answer: a
44. Which of the following describes a bijective function?
a) A function that is both injective and surjective
b) A function that is only surjective
c) A function that is only injective
d) None of the above

45. If R is a relation on a set A and x ∼ y, what does this mean?


Answer: a

a) x and y are equal


b) x and y are related by R
c) x and y are not related by R
d) x is greater than y
Answer: b
Unit III: Mathematical Logic

a) ∧
46. Which of the following logical operators represents "if and only if"?

b) ∨
c) →
d) ↔

47. What is the truth value of (p ∧ q) when p = true and q = false?


Answer: d

a) True
b) False
c) Undefined
d) None of the above
Answer: b
48. Which of the following is the negation of the statement "If p, then q"?
a) p → ¬q

c) p ∧ ¬q
b) ¬p → q

d) p ∧ q
Answer: c

a) p ∨ ¬p
49. Which of the following is a contradiction?

b) p ∧ ¬p
c) p → q
d) None of the above
Answer: b
50. In a truth table, a tautology is a statement that is:
a) Always true
b) Always false
c) True for some values of p and false for others
d) None of the above
Answer: a
51. Which of the following is an example of a normal form?
a) Conjunctive Normal Form (CNF)
b) Disjunctive Normal Form (DNF)
c) Both a and b
d) None of the above
Answer: c
52. Which of the following is true for logical equivalence?
a) Two statements are logically equivalent if they have the same truth table
b) Two statements are logically equivalent if one is true and the other is false
c) Two statements are logically equivalent if one is false and the other is true
d) None of the above
Answer: a
53. What is the result of the logical expression p → (q → p)?
a) True
b) False
c) Depends on the truth values of p and q
d) None of the above
Answer: a
54. The statement p → (q → r) is logically equivalent to:
a) (p → q) → r

c) (p ∧ q) → r
b) (p → q) → (q → r)

d) None of the above


Answer: a

Unit IV: Matrix Algebra (Continued)

55. Which of the following is a property of the determinant of a matrix?


a) The determinant of a product of matrices is the product of their determinants
b) The determinant of a sum of matrices is the sum of their determinants
c) The determinant of a matrix is always zero
d) The determinant of a matrix is always one
Answer: a
56. Which of the following matrices is called a row matrix?
a) [1, 2, 3]
b) [1; 2; 3]
c) [1, 2; 3, 4]
d) [1]
Answer: a
57. If A is a square matrix, what is the determinant of A multiplied by its adjoint?
a) 0
b) 1
c) The identity matrix
d) The inverse of A
Answer: c
58. What does the inverse of a matrix A represent?
a) A matrix that when multiplied by A gives the identity matrix
b) A matrix that when added to A gives the identity matrix
c) A matrix that has the same values as A
d) None of the above
Answer: a
59. Which of the following is a property of a symmetric matrix?
a) A = Aᵀ
b) A = -A
c) A = A⁻¹
d) A = I
Answer: a
60. If a matrix has all its diagonal elements equal to 1 and all off-diagonal elements
equal to 0, it is called:
a) Diagonal matrix
b) Identity matrix
c) Zero matrix
d) Singular matrix
Answer: b
61. If A and B are matrices, the inverse of their product is given by:
a) (AB)⁻¹ = A⁻¹B⁻¹
b) (AB)⁻¹ = B⁻¹A⁻¹
c) (AB)⁻¹ = (A⁻¹B)
d) None of the above
Answer: b
62. Which of the following is a property of the transpose of a matrix?
a) (A + B)ᵀ = Aᵀ + Bᵀ
b) (AB)ᵀ = AᵀBᵀ
c) (Aᵀ)ᵀ = A
d) All of the above
Answer: d
63. The determinant of a matrix is 0 if and only if the matrix is:
a) Invertible
b) Symmetric
c) Singular
d) None of the above
Answer: c
64. Which of the following is a type of matrix that has all its elements equal to 0?
a) Row matrix
b) Zero matrix
c) Identity matrix
d) Diagonal matrix
Answer: b

Unit V: Adjoint Matrix (Continued)

65. The adjoint of a matrix is related to its inverse by the formula:


a) adj(A) = det(A) * A⁻¹
b) adj(A) = A * det(A)
c) adj(A) = A * A
d) adj(A) = A * A⁻¹
Answer: a
66. Which of the following is true about the adjoint of a matrix?
a) The adjoint exists only for square matrices
b) The adjoint is always a diagonal matrix
c) The adjoint is the same as the inverse
d) None of the above
Answer: a
67. What is the property of a matrix that is singular?
a) Its determinant is non-zero
b) It does not have an inverse
c) It is symmetric
d) None of the above
Answer: b
68. If the determinant of a matrix is 0, its inverse cannot be computed because the
matrix is:
a) Non-singular
b) Singular
c) Symmetric
d) None of the above
Answer: b
69. What is the inverse of the identity matrix?
a) The identity matrix
b) The zero matrix
c) A diagonal matrix
d) None of the above
Answer: a

Unit I: Abstract Data Types (ADTs)

1. Which of the following is NOT a type of linked list?


a) Singly linked list
b) Doubly linked list
c) Circular linked list
d) Array-based list
Answer: d
2. In a singly linked list, each node contains a pointer to:
a) Its previous node
b) Its next node
c) Both its previous and next nodes
d) None of the above
Answer: b
3. Which operation is NOT typically associated with lists?
a) Insertion
b) Deletion
c) Searching
d) Tree Traversal
Answer: d
4. What is the time complexity for accessing an element in a singly linked list?
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: c
5. Which of the following is true for circular linked lists?
a) The last node points to NULL
b) The last node points to the first node
c) The first node points to NULL
d) There is no next node in the list
Answer: b
6. Which of the following applications can be implemented using a linked list?
a) Polynomial manipulation
b) Sorting algorithms
c) Searching algorithms
d) All of the above
Answer: a
7. In which scenario would you prefer a doubly linked list over a singly linked list?
a) When you need to access elements in a sequential manner
b) When you need to traverse in both directions
c) When you need constant-time insertion and deletion
d) All of the above
Answer: b
8. What is the main advantage of using a linked list over an array?
a) Dynamic size allocation
b) Faster access time
c) Less memory usage
d) Random access capability
Answer: a
9. The merging of two sorted linked lists results in a:
a) Sorted linked list
b) Unsorted linked list
c) List with duplicates
d) Circular linked list
Answer: a
10. Which of the following operations is NOT performed in polynomial
manipulation using linked lists?
a) Insertion
b) Deletion
c) Merging
d) Sorting
Answer: d

Unit II: Stack

11. What is the time complexity for push and pop operations in a stack?
a) O(n)
b) O(log n)
c) O(1)
d) O(n²)
Answer: c
12. Which of the following expressions is valid in stack-based operations?
a) Push(10)
b) Pop(20)
c) Stack[10]
d) None of the above
Answer: a
13. Which of the following is NOT an application of stacks?
a) Undo mechanism in text editors
b) Expression evaluation
c) Finding the shortest path in a graph
d) Backtracking algorithms
Answer: c
14. How do we convert an infix expression to a postfix expression?
a) By using a stack
b) By using a queue
c) By recursively evaluating the expression
d) None of the above
Answer: a
15. Which of the following is true about a priority queue?
a) The element with the highest priority is dequeued first
b) The element with the lowest priority is dequeued first
c) Elements are dequeued in the order they were added
d) None of the above
Answer: a
16. In a circular queue, the last element points to:
a) NULL
b) The first element
c) A random element
d) The middle element
Answer: b
17. Which operation is NOT supported by a deque?
a) Insertion at the front
b) Insertion at the rear
c) Deletion from the front
d) Deletion from the middle
Answer: d
18. Which of the following is the correct sequence for evaluating an arithmetic
expression in postfix notation?
a) Left to right
b) Right to left
c) In order of precedence
d) None of the above
Answer: a
19. What is the time complexity for accessing an element in a queue?
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: a
20. A queue is useful for:
a) Depth-first search
b) Breadth-first search
c) Sorting
d) Backtracking
Answer: b

Unit III: Tree ADT

21. Which of the following is a traversal method in a binary tree?


a) Inorder
b) Preorder
c) Postorder
d) All of the above
Answer: d
22. Which type of tree is used for efficient searching and sorting?
a) Binary search tree
b) AVL tree
c) B-tree
d) All of the above
Answer: d
23. In a threaded binary tree, the right child of a node points to:
a) The left child
b) The parent node
c) The in-order successor
d) NULL
Answer: c
24. Which of the following is a characteristic of an AVL tree?
a) Balanced binary search tree
b) Height-balanced property
c) O(log n) search, insert, and delete operations
d) All of the above
Answer: d
25. In a binary search tree (BST), which of the following is true?
a) Left child’s key is greater than the parent’s key
b) Right child’s key is smaller than the parent’s key
c) Left child’s key is smaller than the parent’s key
d) There is no relationship between parent and child keys
Answer: c
26. Which of the following is a balanced tree with a fixed maximum number of
children per node?
a) B-tree
b) AVL tree
c) Binary search tree
d) None of the above
Answer: a
27. What is the maximum height of a binary tree with n nodes?
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: c
28. Which of the following trees is used in databases for efficient storage and
retrieval?
a) B-tree
b) B+ tree
c) AVL tree
d) Both a and b
Answer: d
29. The maximum number of children a node can have in a B-tree is:
a) 2
b) 3
c) 4
d) Depends on the order of the B-tree
Answer: d
30. Which of the following is NOT an application of trees?
a) File systems
b) Database indexing
c) Pathfinding algorithms
d) Hash table collision resolution
Answer: d

Unit IV: Graph

31. Which of the following is the representation of a graph?


a) Adjacency matrix
b) Adjacency list
c) Incidence matrix
d) All of the above
Answer: d
32. Which of the following is a traversal technique for graphs?
a) Depth-first search
b) Breadth-first search
c) Both a and b
d) None of the above
Answer: c
33. Which of the following is a feature of a directed graph?
a) Each edge has a direction
b) There are no loops
c) All edges are bidirectional
d) None of the above
Answer: a
34. In which traversal method is the graph explored level by level?
a) Depth-first search
b) Breadth-first search
c) Both a and b
d) None of the above
Answer: b
35. Which algorithm is used for finding the shortest path in an unweighted graph?
a) Dijkstra’s algorithm
b) Bellman-Ford algorithm
c) BFS algorithm
d) Kruskal’s algorithm
Answer: c
36. Which of the following is true for a bipartite graph?
a) The graph can be colored using two colors
b) Every vertex has an edge to every other vertex
c) The graph contains a cycle of length 3
d) None of the above
Answer: a
37. In a directed acyclic graph (DAG), the edges have a:
a) Cyclic nature
b) Unidirectional flow
c) Bidirectional flow
d) None of the above
Answer: b
38. Which algorithm is used for topological sorting of a directed acyclic graph
(DAG)?
a) DFS
b) BFS
c) Dijkstra’s algorithm
d) Bellman-Ford algorithm
Answer: a
39. Which of the following is an application of graphs?
a) Social network analysis
b) Routing algorithms
c) Network flow analysis
d) All of the above
Answer: d
40. What is the time complexity of DFS for a graph with n vertices and m edges?
a) O(n + m)
b) O(n²)
c) O(m²)
d) O(n log m)
Answer: a

Unit V: Searching

41. Which search algorithm is the fastest for a large sorted array?
a) Linear search
b) Binary search
c) Hashing
d) Jump search
Answer: b
42. What is the time complexity of binary search in the worst case?
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: b
43. Which of the following sorting algorithms is an unstable sort?
a) Bubble sort
b) Merge sort
c) Quick sort
d) Insertion sort
Answer: c
44. Which sorting algorithm has the best average case performance?
a) Bubble sort
b) Selection sort
c) Merge sort
d) Quick sort
Answer: c
45. In which sorting algorithm does the time complexity improve with smaller input
sizes?
a) Bubble sort
b) Merge sort
c) Selection sort
d) Quick sort
Answer: a
46. Which of the following is a property of radix sort?
a) It works only for numerical data
b) It uses comparisons to sort elements
c) It sorts elements based on digit significance
d) All of the above
Answer: c
47. Which type of hashing technique is used for collision resolution in hash tables?
a) Separate chaining
b) Linear probing
c) Quadratic probing
d) All of the above
Answer: d
48. What is the advantage of using extendible hashing over linear hashing?
a) It reduces overflow
b) It increases the speed of insertions
c) It improves memory utilization
d) All of the above
Answer: d
49. In separate chaining, collisions are resolved by:
a) Storing colliding elements in a linked list
b) Rehashing the table
c) Using a different hash function
d) None of the above
Answer: a
50. Which of the following is true about the binary search algorithm?
a) It works only on sorted arrays
b) It can be applied to linked lists
c) It has a time complexity of O(n)
d) It requires a linear scan of the array
Answer: a

Unit I: Abstract Data Types (ADTs)

51. Which of the following operations can be efficiently implemented using a stack?
a) Undo operation in editors
b) Traversing a graph
c) Sorting
d) Finding the maximum value in an array
Answer: a
52. In a singly linked list, how do you insert a new node at the beginning?
a) Change the next pointer of the last node
b) Create a new node and make it point to the head
c) Make the last node point to the first node
d) None of the above
Answer: b
53. Which of the following is a common application of a circular linked list?
a) Implementing the undo functionality in an editor
b) Implementing round-robin scheduling in operating systems
c) Finding the middle element in a list
d) Sorting data
Answer: b
54. Which of the following is the time complexity of deleting a node from a singly
linked list (given the node is known)?
a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: a
55. What is the primary difference between a singly and doubly linked list?
a) A doubly linked list allows traversal in both directions, while a singly linked list
allows only one direction.
b) A doubly linked list is slower than a singly linked list.
c) A singly linked list contains extra pointers.
d) None of the above
Answer: a

Unit II: Stack

56. In an expression evaluation, the postfix expression 5 2 + 3 * is equivalent to:


a) (5 + 2) * 3
b) 5 + (2 * 3)
c) 5 * 2 + 3
d) None of the above
Answer: a
57. Which of the following is an application of a stack in programming?
a) Parenthesis matching
b) Sorting a list
c) Finding the shortest path in a graph
d) Matrix multiplication
Answer: a
58. The primary reason to use a stack in the conversion of infix expressions to
postfix is to:
a) Store the operands
b) Store operators in the correct order
c) Maintain the parentheses
d) Ensure correct precedence of operators
Answer: d
59. Which of the following is the correct sequence of operations for evaluating a
postfix expression?
a) Scan the expression from left to right, and for each operator, pop operands and
perform the operation.
b) Reverse the expression and then apply the infix rules.
c) Evaluate operators before operands.
d) None of the above
Answer: a
60. Which of the following is an application of a priority queue?
a) Operating system task scheduling
b) Graph traversal
c) Queueing tasks in a web server
d) Binary tree construction
Answer: a

Unit III: Tree ADT

61. Which of the following traversal methods is used to search for a node in a binary
search tree?
a) Inorder traversal
b) Preorder traversal
c) Postorder traversal
d) All of the above
Answer: a
62. In a binary search tree (BST), what is the time complexity of the search
operation in the worst case?
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: c
63. Which tree structure balances itself automatically after each insertion or
deletion?
a) Binary Search Tree (BST)
b) AVL Tree
c) Binary Heap
d) B-tree
Answer: b
64. In an AVL tree, what must be true for it to remain balanced?
a) The height of the left and right subtrees of any node must differ by at most 1.
b) The left subtree must be smaller than the right subtree.
c) The height difference between subtrees must be 2 or greater.
d) The root must always be a leaf node.
Answer: a
65. What is the height of a balanced binary search tree with n nodes?
a) O(n)
b) O(log n)
c) O(n²)
d) O(n log n)
Answer: b
66. Which of the following is NOT true for a threaded binary tree?
a) It allows for efficient in-order traversal without using a stack.
b) It stores a reference to the in-order predecessor or successor for each node.
c) The threads make traversal slower than a regular binary tree.
d) It is used to efficiently traverse a binary tree in a non-recursive manner.
Answer: c

Unit IV: Graph

67. What is the time complexity of a Breadth-First Search (BFS) on a graph with n
vertices and m edges?
a) O(n + m)
b) O(n log n)
c) O(m²)
d) O(n²)
Answer: a
68. Which of the following is a feature of a directed acyclic graph (DAG)?
a) It contains at least one cycle.
b) It has directed edges and no cycles.
c) All edges are undirected.
d) It is a tree.
Answer: b
69. Which of the following graph traversal algorithms is used for finding the
shortest path in an unweighted graph?
a) Dijkstra’s algorithm
b) Depth-First Search (DFS)
c) Breadth-First Search (BFS)
d) A* algorithm
Answer: c
70. What is the minimum number of edges in a connected graph with n vertices?
a) n-1
b) n
c) 2n
d) n²
Answer: a
71. In a topological sort of a directed acyclic graph (DAG), the vertices are ordered:
a) By their incoming edges
b) By their outgoing edges
c) From the root to the leaves
d) Based on the in-degree
Answer: a

Unit V: Searching and Sorting


72. Which of the following sorting algorithms is the fastest in the average case?
a) Quick sort
b) Bubble sort
c) Merge sort
d) Insertion sort
Answer: a
73. What is the worst-case time complexity of merge sort?
a) O(n log n)
b) O(n)
c) O(n²)
d) O(log n)
Answer: a
74. Which of the following sorting algorithms is stable?
a) Quick sort
b) Merge sort
c) Heap sort
d) Selection sort
Answer: b
75. What is the main advantage of radix sort over comparison-based sorting
algorithms?
a) Radix sort is faster than quick sort for large datasets.
b) Radix sort does not depend on comparisons.
c) Radix sort requires no memory space.
d) Radix sort can handle both integers and floating-point numbers efficiently.
Answer: b

Unit-I: Number Systems and Digital Logic

1. Which of the following is the binary representation of the decimal number 12?
A) 1100
B) 1011
C) 1001
D) 1111

2. What is the decimal equivalent of the binary number 101101?


A) 47
B) 44
C) 51
D) 48

3. Convert the hexadecimal number A5 to binary.


A) 10100001
B) 10010101
C) 11010001
D) 10100101

4. The ASCII code for the letter 'A' is:


A) 65
B) 97
C) 32
D) 100

5. The Excess-3 code is also known as:


A) Gray Code
B) BCD Code
C) Decimal Code
D) Offset Binary Code

76. 6. The Gray code equivalent of the binary number 1011 is:
A) 1111
B) 1101
C) 1001
D) 1011
77. 7. Which of the following gates is a universal gate?
A) AND
B) OR
C) NOR
D) XOR
78. 8. The NOR gate is the combination of which gates?
A) OR and NOT
B) AND and NOT
C) AND and OR
D) NAND and NOT
79. 9. The output of an AND gate is 1 when:
A) At least one input is 1
B) Both inputs are 1
C) Both inputs are 0
D) At least one input is 0
80. 10. What is the Boolean expression for the output of an OR gate?
A) A + B
B) A . B
C) A' + B'
D) A' . B'
81. 11. Which of the following is NOT a digital code?
A) ASCII
B) BCD
C) Roman numeral
D) Excess-3
82. 12. The 2's complement of the binary number 1010 is:
A) 0101
B) 1101
C) 0110
D) 1011
83. 13. What does the Gray code help in?
A) Reducing errors during digital signal processing
B) Representing negative numbers
C) Storing decimal numbers
D) Enabling fast multiplication
84. 14. A NOT gate is also known as:
A) Inverter
B) AND gate
C) OR gate
D) NAND gate
85. 15. Which of the following is a universal logic gate?
A) OR
B) AND
C) XOR
D) NAND

86.Unit-II: Combinational Logic


87. 16. The Sum of Products (SOP) method is used in which logic design process?
A) Boolean algebra simplification
B) Conversion from binary to decimal
C) Truth table analysis
D) Karnaugh map simplification
88. 17. The Boolean expression for the following truth table:
(0, 1, 1, 0) is:
A) A'B + AB'
B) A'B' + AB
C) AB + A'B'
D) A'B'
89. 18. What is the primary use of Karnaugh maps?
A) To design sequential circuits
B) To simplify Boolean expressions
C) To convert binary numbers to hexadecimal
D) To count logic gates
90. 19. In the Karnaugh map simplification, what does a "Don't Care" condition imply?
A) The output can be either 0 or 1
B) The output must be 1
C) The output must be 0
D) It can be ignored in simplification
91. 20. The Boolean expression for a two-variable Karnaugh map with the following
minterms (1, 2) is:
A) A + B
B) A'B
C) AB'
D) A'B'
92. 21. What is the result of simplifying the expression A + A'B?
A) A + B
B) A' + B
C) A
D) A'
93. 22. What are the essential prime implicants of a Boolean function?
A) The smallest expressions that can represent the function
B) The largest expressions that can represent the function
C) All possible combinations
D) Unnecessary combinations
94. 23. Which simplification method uses grouping of 1s in a truth table to simplify a
Boolean expression?
A) Sum of Products
B) Karnaugh Map
C) Boolean Theorem
D) Truth Table Expansion
95. 24. The term "Quads" in Karnaugh maps refers to:
A) A group of 4 cells
B) A group of 2 cells
C) A group of 8 cells
D) A single cell

25. What is the Boolean expression for the simplified result of the expression A'B + AB?
A) A
B) B
C) A + B
D) A' + B

Unit-III: Data Processing and Arithmetic Circuits

26. Which of the following circuits is used to select one of many inputs?
A) Multiplexer
B) Decoder
C) Encoder
D) Demultiplexer

96. 27. A Demultiplexer is used to:


A) Combine multiple inputs into a single output
B) Split a single input into multiple outputs
C) Perform arithmetic operations
D) Convert binary to decimal
97. 28. A 1-of-16 decoder will have how many inputs and outputs?
A) 1 input, 16 outputs
B) 16 inputs, 1 output
C) 4 inputs, 16 outputs
D) 16 inputs, 16 outputs
98. 29. A BCD-to-Decimal decoder converts:
A) Decimal input to binary output
B) Binary input to BCD output
C) BCD input to decimal output
D) Decimal input to seven-segment display
99. 30. The Exclusive-OR gate (XOR) produces a high output when:
A) Both inputs are the same
B) Both inputs are different
C) One input is high
D) Both inputs are low
100.31. Which operation is performed by a BCD adder?
A) Binary addition
B) Decimal addition
C) Binary-coded decimal addition
D) 2's complement addition
101.32. The result of subtracting a number using 2's complement arithmetic is represented
by:
A) Adding the 2's complement of the number
B) Direct subtraction
C) Converting the number into BCD
D) Using 1's complement
102.33. Which of the following is used to perform binary addition of numbers in digital
circuits?
A) AND gate
B) OR gate
C) Full adder
D) Decoder
103.34. A binary subtraction operation is performed using which method?
A) 1's complement
B) 2's complement
C) Excess-3 code
D) Gray code
104.35. Which of the following is the correct representation for negative binary numbers
using 2’s complement?
A) Adding a leading 1
B) Inverting bits and adding 1
C) Inverting bits and subtracting 1
D) Using excess-3 code
105.
106. Unit-IV: Flip-Flops
107.36. An RS Flip-Flop has:
A) Two inputs, one output
B) Two outputs, one input
C) One input, one output
D) One input, two outputs
108.37. The edge-triggered RS Flip-Flop responds to:
A) High-level input
B) Low-level input
C) A specific edge of the clock pulse
D) A specific voltage level
109.38. The JK Flip-Flop is a modified version of which flip-flop?
A) RS Flip-Flop
B) D Flip-Flop
C) T Flip-Flop
D) SR Flip-Flop
110.39. The main advantage of a JK Flip-Flop over an RS Flip-Flop is:
A) It has no invalid state
B) It has a clock input
C) It performs only logical operations
D) It requires only one input
111.40. The JK Master-Slave Flip-Flop eliminates which problem of the basic JK Flip-
Flop?
A) The indeterminate state
B) The invalid state
C) The timing issue
D) The propagation delay
112.41. What is the primary use of flip-flops in digital systems?
A) To perform logical operations
B) To store data and manage timing
C) To simplify Boolean expressions
D) To add binary numbers
113.42. A D Flip-Flop is commonly used to store:
A) A single bit of data
B) A multi-bit number
C) Address data
D) Control signals
114.43. The characteristic equation of a JK Flip-Flop is:
A) Q = JQ' + K'Q
B) Q = JQ + KQ'
C) Q = Q'J + QK'
D) Q = JK' + J'Q
115.44. What is the output state of an RS Flip-Flop when both inputs are high?
A) Set
B) Reset
C) Indeterminate
D) Stable

116. Unit-V: Registers


117.45. A register is used to store:
A) Data in binary form
B) A single bit of information
C) Inputs and outputs of a gate
D) Clock pulses
118.46. Which type of register allows data to be shifted serially in and out?
A) Serial-in serial-out register
B) Parallel-in serial-out register
C) Universal shift register
D) Serial-in parallel-out register
119.47. The Parallel-in Parallel-out register stores data:
A) Serially
B) In parallel, with direct access to each bit
C) Sequentially
D) In a shift register format
120.48. A Universal shift register can perform:
A) Shifting in both directions
B) Only parallel data storage
C) Only serial data storage
D) Arithmetic operations
121.49. A Serial-in Parallel-out register can be used to:
A) Convert parallel data to serial
B) Convert serial data to parallel
C) Store arithmetic results
D) Simplify Boolean expressions
122.50. Which of the following registers shifts data to the right by one position on each
clock pulse?
A) Serial-in serial-out register
B) Parallel-in parallel-out register
C) Shift register
D) Universal shift register

You might also like