Q1. 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]);
Answers: (b)
Q2. 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
Answers : (b)
Q3. 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
Answers: (c)
Q4. Local variables are stored in an area called ___________
a) Heap
b) Permanent storage area
c) Free memory
d) Stack
Answer: d
Explanation: Local variables are stored in an area called stack. Global variables, static variable and program instructions are stored in the permanent storage area. The memory space between these two regions is known a heap.
Q5. A condition where in memory is reserved dynamically but not accessible to any of the programs is called _____________
a) Memory leak
b) Dangling pointer
c) Frozen memory
d) Pointer leak
Answer: a
Explanation: If we allocate memory dynamically in an function (malloc, calloc, realloc), the allocated memory will not be de-allocated automatically when the control comes out of the function. This allocated memory cannot be accessed and hence cannot be used. This unused inaccessible memory results in memory leak.
Q6. What is the Aesthetic principle among the following?
a) High quality programs can be constructed from self contained, understandable parts or modules
b) A design will be more or less easy to be build
c) Beauty is one of the important factor to be acknowledged as design principle
d) None of the mentioned
Answer: c
Explanation: Aesthetic principle states Beauty as one of the most important factor to be acknowledged.
Q7. The incorrect statement with respect to dangling pointers is ___________
a) Pointer pointing to non-existent memory location is called dangling pointer
b) When a dynamically allocated pointer references the original memory after it has been freed, a dangling pointer arises
c) If memory leak occurs, it is mandatory that a dangling pointer arises
d) Dangling pointer may result in segmentation faults and potential security risks
Answer: c
Explanation: Memory leak and dangling pointers are not inter dependent. Hence, when memory leak occurs, it is not mandatory that a dangling pointer arises
Q8. The free() function frees the memory state pointed to by a pointer and returns ___________
a) the same pointer
b) the memory address
c) no value
d) an integer value
Answer: c
Explanation: The free() function frees the memory state pointed by a pointer and returns no value.
Q9. 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 above.
Answer: c
Explanation: None.
Q10. What is the size of *ptr in a 32-bit machine (Assuming initialization as int *ptr = 10;)?
a) 1
b) 2
c) 4
d) 8
Answer: c
Explanation: None.
Q11. . Which of the following life cycle model can be chosen if the development team has less experience on similar projects?
a) Spiral
b) Waterfall
c) RAD
d) Iterative Enhancement Model
Answer: a
Explanation: Relying on risk assessment/analysis provides more flexibility than required for many applications which overcomes the criteria of less experienced developers.
Q12. Choose the correct option from given below:
a) Prototyping Model facilitates reusability of components
b) RAD Model Model facilitates reusability of components
c) Both RAD & Prototyping Model facilitates reusability of components
d) None
Answer: c
Explanation: None.
Q13. What does Coupling means ?
a) Coupling is the degree of connection between pair of module
b) Coupling is the degree to which a module’s part are related to one another
c) All of the mentioned
d) None of the mentioned
Answer: a
Explanation: Coupling is the degree of connection between pair of module.
Q14. The code shown below is an example of:
#include
#include
#include
main()
{
char *p,*q;
p=(char*)malloc(3*sizeof(char));
q=p;
strcpy(p,"hello");
printf("p=%s",p);
printf("q=%s",q);
free(q);
q=NULL;
gets(p);
gets(q);
printf("%s",p);
printf(“%s”,q);
}
a) Memory leak
b) Dangling pointer
c) Static memory allocation
d) Linked list
Answer: b
Explanation: In the above code, the pointer p, points to a memory location which has been freed. Hece the above code is an example of dangling pointer.
Q 15. Which of these is correct with context to coupling?
a) Failure to hide information leads to loose coupling and cannot be avoided
b) Modules that communicate using special data types and structures are less tightly coupled than modules with simple values
c) When modules communicate only through public module interface, their coupling strength is proportional to the number of messages and number of data passed in between
d) All of the mentioned
Answer: c
Explanation: Failure to hide
Note: Click here to visit TCS NQT C MCQ Questions
It is interesting
its going to be very interesting
I really got into this website. I found it to be interesting and loaded with unique points of view.
Coding will be related to C only….not any other programming language