This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Table Lookup – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
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);
View Answer
Explanation: None.
2. Which algorithm is used for searching in the table?
a) List search
b) Informed search
c) Hash search
d) Adversarial search
View Answer
Explanation: 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);
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: None.
7. What will be the output of the following C code?
#include <stdio.h>
struct student
{
char a[];
};
void main()
{
struct student s;
printf("%d", sizeof(struct student));
}
a) Compile time error
b) 8
c) 1
d) Varies
View Answer
Explanation: None.
8. What will be the output of the following C code?
#include <stdio.h>
int main()
{
struct p
{
char *name;
struct p *next;
};
struct p *ptrary[10];
struct p p, q;
p.name = "xyz";
p.next = NULL;
ptrary[0] = &p;
q.name = (char*)malloc(sizeof(char)*3);
strcpy(q.name, p.name);
q.next = &q;
ptrary[1] = &q;
printf("%s\n", ptrary[1]->next->next->name);
}
a) Compile time error
b) Depends on the compiler
c) Undefined behaviour
d) xyz
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check C Books
- Watch Advanced C Programming Videos
- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Check Computer Science Books