1. An array is a collection of data items of different types using a single name
ID: 3874642 • Letter: 1
Question
1. An array is a collection of data items of different types using a single name (T / F) 2. A structure can be declared without a tag name (T F). 3. A structure variable can be initialized (T / F). 4. A function can return multiple values if arguments are passed by value (T /F 5. A union can contain members of different types (T /F) 6. The identifiers in an enumeration type (enum) are constants of type double (T / F). 7. If x is a one-dimensional array, x +3 is the same as13] (T / F 8. The arrow operator-> is used to access members of a structure using pointers (T F. 9. realloc) is used to release previously allocated space (T F) 10. fork () is used to run commands from a C program just as if they were from the UNIX command line (T / F).Explanation / Answer
Hello, I have answers for your questions.
1. An array is the collection of data items of different types using a single name.
Answer: False, Array is a homogeneous (similar type) collection of data items grouped under a single name.
2. A structure can be declared without a tag name?
Answer : True, a structure can be declared without a tag name, but the objects of this structure can be defined only during structure definition
struct{
int x;
float y;
} object ;
In the above example, a structure without a tag name is created, and an object of it is defined.
3. A structure variable can be initialized?
Answer: if you are talking about variables defined inside a structure, then False, you cannot initialize a variable because it defines a type instead of variables, and no memory is allocated at that time. And if you are talking about initializing a structure, yes it can be done during structure definition.
struct{
int a;
char b;
} obj1={10,'A'};
Here, in the above example, we have defined and initialized a structure.
4. A function can return multiple values if arguments are passed by value?
Answer: False. A function can only return one value. But if the arguments are passed by reference (pointers), it can 'indirectly' return multiple values using the capabilities of a pointer.
5. A union can contain members of different types?
Answer: True, a union is similar to structure in all the terms except in memory allocation. So, a union can have members of different types.
6. The identifiers of enum type are constants of type double?
Answer: False, identifiers in an enumeration type are constants of integer (int) type.
7. if x is one dimensional array,x+3 is the same as x[3]
Answer: Array name acts as a pointer to the first element of the array. So, if an array is named a s x, then x will be holding pointer to the first element i.e x[0], and adding integers to the pointer can be used to access elements at specific indice. i.e x+3 will point to the element at x[3]. Answer is True. Note that, x+3 will be pointing to the address of 3rd element in the array, so *x+3 will return element at x[3]
8. The arrow operator -> is used to access members of a structure using pointers?
Answer: True. if we are using pointers , we can access the members of a struct using -> operator instead of 'dot' operator.
9. realloc() is used to release previously allocated space?
Answer: False, realloc() is used to re allocate memory which has been allocated previously using malloc(), like to increase or decrease the memory size. If you want to explicitly release the allocated space, you can use free() function.
10. fork() is used to run commands from a C program just as if they were from the UNIX command line.?
Answer: False, fork() method is used to generate a new process thread which will be the child process of the current process and executes simultaneously.
Answers for fill in the spaces questions.
1. Removes comments from source code - pre processor
2. a subroutine that may include one of more statments designed to perform a specific task- function
3. Defines all symbolic constants - definition section
4. Variables used for more than one function - global variables
5. A set of comment lines example, Program name etc - documentation section
6. Area where program instructions and global variables are stored- permanent storage area
7. Contains all the user defined functions- subprogram section
8- A single running program- process
9- A text editor for Unix OS - vi
10. Area where local variables are stored - stack
Feel free to drop a comment if you have any doubts. Thanks
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.