Question: 1 . State True or False: a ) A string is a specific type of array, an array of char, containing a sequence of values

1. State True or False:
a) A string is a specific type of array, an array of char, containing a sequence of values where a value of \1 signifies the end of the string.
b) A structure is intended to group together an assortment of values of different types under a single variable name.
c) The value of a sentinel is not intended to be used in a computation, but to be used to terminate the processing of a list of data.
d) The sprintf function works just like the printf function except that the output prints into a integer variable.
e) Logic operations are independent of any programming language used to implement them.
f) The & operator fetches the address of the variable in memory.
g) Array elements are stored in contiguous memory locations and so they can be accessed using pointers.
h) The three most common bitmask operations work on a single bit: set the bit, fill the bit, or query the value of the bit.
i) The operating system allocates three streams namely input, output and error stream to a program when it is created.
j) The printf() function also provides the %p identifier for pointers, to display the address in hexadecimal.
2. Multiple Choice Questions:
a) In C, a pointer is a variable that contains an address. If you add 2 to a pointer, then:
i) the resulting value is the address plus 2
ii) the resulting value depends on what value the pointer points to
iii) the resulting value depends on the data type of the pointer
iv) a segmentation fault is thrown
b) When you pass an array as an argument to a C function, then:
i) the array elements are passed by value (i.e., a copy of the array is made, including copying each element of the array)
ii) since arrays are really just pointers, a pointer to the first element of the array is passed and no array elements are copied.
iii) a compiler error is thrown since you cannot pass arrays as arguments.
iv) what happens depends on the type of the array.
c) Prior to using a pointer variable, it should be
i) Declared ii) Initialized iii) Both declared and initialized iv) None of these
d) What is the correct value to return to the operating system upon the successful completion of a program?
i)1 ii)-1 iii)0 iv)2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!