250+ TOP MCQs on Table Lookup and Answers

tricky C questions on “Table Lookup”. One shall practice these tricky questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C programming questions on “Table Lookup” along with answers, explanations and/or solutions:

1. Which function is responsible for searching in the table? (For #define IN 1, the name IN and replacement text 1 are stored in a “table”)
a) findout(s);
b) lookup(s);
c) find(s);
d) lookfor(s);
Answer: b
Clarification: None.

2. Which algorithm is used for searching in the table?
a) List search
b) Informed search
c) Hash search
d) Adversarial search
Answer: c
Clarification: None.

3. Which function is responsible for recording the name “s” and the replacement text “t” in a table?
a) install(s, t);
b) fix(s, t);
c) setup(s, t);
d) settle(s, t);
Answer: a
Clarification: None.

4. Which of the following statement is true?
a) Install function uses lookup
b) lookup function uses install
c) Install and lookup function work independently
d) None of the mentioned
Answer: a
Clarification: None.

5. What happens when install(s, t) finds that the name being installed is already present in the table?
a) It doesn’t modify the name in the table
b) It modifies the name with new definition
c) It modifies off the new definition has higher priority
d) It creates a new table and add the new definition in it

Answer: b
Clarification: None.

6. In what situation, install function returns NULL?
a) When there is no memory for adding new name
b) When the name to be defined is already present in the table
c) Whenever a new name is added to the table
d) All of the mentioned
Answer: a
Clarification: None.

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

  1.     #include 
  2.     struct student
  3.     {
  4.         char a[];
  5.     };
  6.     void main()
  7.     {
  8.         struct student s;
  9.         printf("%d", sizeof(struct student));
  10.     }

a) Compile time error
b) 8
c) 1
d) Varies
Answer: a
Clarification: None.

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

  1.     #include 
  2.     int main()
  3.     {
  4.         struct p
  5.         {
  6.             char *name;
  7.             struct p *next;
  8.         };
  9.         struct p *ptrary[10];
  10.         struct p p, q;
  11.         p.name = "xyz";
  12.         p.next = NULL;
  13.         ptrary[0] = &p;
  14.         q.name = (char*)malloc(sizeof(char)*3);
  15.         strcpy(q.name, p.name);
  16.         q.next = &q;
  17.         ptrary[1] = &q;
  18.         printf("%sn", ptrary[1]->next->next->name);
  19.     }

a) Compile time error
b) Depends on the compiler
c) Undefined behaviour
d) xyz
Answer: d
Clarification: None.

contest

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top