Advertisements

Search results for struct

Example:[1]

            A state machine in C programming is?
          
Option A:

             a way of structuring a program to structure it around a set of states and the events that can cause it to change state.
            
Option B:

            a way to go to a certain state no matter what the program does.
            
Option C:

            a way to recover the program from asserts.
            
Option D:

            None of the given above.
            
Correct Answer: option A
Example:[2]

            Which of the following statement is not true regarding structure in a c program?
          
Option A:

            Keyword struct introduces a structure definition.
            
Option B:

            Structures contain variables of many different data types.
            
Option C:

            Structures are commonly used to define records to be stored in files.
            
Option D:

            Each structure definition must end with a comma.
            
Correct Answer: option D
Example:[3]

            What is nested structure in C? 
          
Option A:

            Nested structure is the structure in which the pointer points to any data type. 
            
Option B:

            Nested structure is the structure in which the pointer points to the structure of the same type. 
            
Option C:

            Nested structure is the structure in which the pointer points to another structure.
            
Option D:

            Nested structure is a structure in which a structure is declared inside another structure. 
            
Correct Answer: option D
Example:[4]

            Which of the following is true for the statement:
school.nursery.students = 10;
          
Option A:

            The structure students is nested within the structure nursery.
            
Option B:

            The structure school is nested within the structure nursery.
            
Option C:

            The structure nursery is nested within the structure school.
            
Option D:

            The structure nursery is nested within the structure students. 
            
Correct Answer: option C
Example:[5]

            What is the output of the following program?
#include <stdio.h>
#include <string.h>
struct test
{
  char s[10];
};
void myfunc(struct test *d)
{
  strcpy(d->s,"World");
}
void main()
{
  struct test t;
  myfunc(&t);
  printf("%s", t.s);
}
          
Option A:

            No output
            
Option B:

            World
            
Option C:

            Compile error
            
Option D:

            Garbage output
            
Correct Answer: option B
Example:[6]

            What is the output of the following program?
#include <stdio.h>
#include <string.h>
void myfunc(struct test *d)
{
  strcpy(d->s,"World");
}
void main()
{
  struct test
  {
    char s[10];
  };
  struct test t;
  myfunc(&t);
  printf("%s", t.s);
}
          
Option A:

            No output
            
Option B:

            World
            
Option C:

            Compile error
            
Option D:

            Garbage output
            
Correct Answer: option C
Example:[7]

            What will be the output of the following program if int takes 4 bytes and char takes 1 byte?
#include <stdio.h>
struct student
{
   	int a;
   	char b;
};
void main()
{
	struct student s;
    printf("%d\n", sizeof(s));
}
          
Option A:

            1
            
Option B:

            5
            
Option C:

            4
            
Option D:

            6
            
Correct Answer: option B
Example:[8]

            What will be the output of the following program?
#include <stdio.h>
struct fiddle
{
	unsigned int itals :1; 
	unsigned int body  :2; 
	unsigned int color :2;
	unsigned int       :3; 
};
void main()
{
	printf("%d\n", sizeof(struct fiddle));
}
          
Option A:

            4
            
Option B:

            16
            
Option C:

            8
            
Option D:

            None of the mentioned.
            
Correct Answer: option A
Example:[9]

            struct time is written below to represent current time of the day? What are the values of A,B,C?
struct time
{
   unsigned int mins : A;
   unsigned int seconds : B;
   unsigned int hour : C;
};
          
Option A:

            A is 6, B is 6, C is 5
            
Option B:

            A is 6, B is 5, C is 6
            
Option C:

            A is 5, B is 6, C is 6
            
Option D:

            Can't say, compiler dependent
            
Correct Answer: option A
Example:[10]

            What is self referential structure in C?
          
Option A:

            Self Referential Structure is the Data Structure in which the pointer points to NULL. 
            
Option B:

            Self Referential Structure is the Data Structure in which the pointer points to any data type. 
            
Option C:

            Self Referential Structure is the Data Structure in which the pointer points to the structure of the same type. 
            
Option D:

            Self Referential Structure is the Data Structure in which the pointer points to another structure. 
            
Correct Answer: option C
Example:[11]

            A data structure in which an element is added and removed only from one end, is known as
          
Option A:

            Queue
            
Option B:

            Stack
            
Option C:

            In-built structure 
            
Option D:

            None of the above
            
Correct Answer: option B
Example:[12]

            For implementing recursive function the data structure used is:
          
Option A:

            Queue
            
Option B:

            Stack
            
Option C:

            Linked List
            
Option D:

            Tree
            
Correct Answer: option B
Example:[13]

            Linked lists are not suitable data structures for which one of the following problems
          
Option A:

            insertion sort 
            
Option B:

            binary search
            
Option C:

            radix sort 
            
Option D:

            polynomial manipulation
            
Correct Answer: option B
Example:[14]

            In linked list each node contains minimum of two fields. The first field is to store the data and the second field is which of the following?
          
Option A:

            Pointer to character
            
Option B:

            Pointer to integer
            
Option C:

            Pointer to node structure
            
Option D:

            Pointer to float
            
Correct Answer: option C
Example:[15]

            Recursive procedures are implemented by using _____ data structure.
          
Option A:

            queues
            
Option B:

            stacks
            
Option C:

            linked lists
            
Option D:

            strings
            
Correct Answer: option B
Example:[16]

            A data structure in which one end is always used to insert data and the other end is used to remove data is called ____
          
Option A:

            Queue
            
Option B:

            Stack
            
Option C:

            In-built structure
            
Option D:

            None of the above
            
Correct Answer: option A
Example:[17]

            A queue is a _____ data structure
          
Option A:

            FIFO
            
Option B:

            LIFO
            
Option C:

            In-built structure 
            
Option D:

            None of the above
            
Correct Answer: option A
Example:[18]

            A stack is a _____ data structure
          
Option A:

            FIFO
            
Option B:

            LIFO
            
Option C:

            In-built structure
            
Option D:

            None of the above
            
Correct Answer: option B

 Search Links


 Popular C search MCQs


 Popular C search examples