# Statement T/F C PROGRAMMING 1. If ch1 contains the value \'C\' and ch2 contain
ID: 3874017 • Letter: #
Question
# Statement T/F C PROGRAMMING
1. If ch1 contains the value 'C' and ch2 contains the value 'K', the value of the expression ch1 >= ch2 is true.
2. A function can be declared several times but can be defined only once.
3. The expressions x++ and ++x can always be used interchangeably.
4. Alphanumeric characters are stored in the computer as integers.
5. An array can be passed as an argument either by value or reference.
6. We can copy array a to array b by b = a;
7. Given “int a[10];” a + i == &a[i]
8. In a function call, C does not copy whole array, but passes the starting address.
9. Size of all but the highest dimension should be specified.
10. &a = a = &*a
11. Pointer constant cannot be assigned, but pointer variable can be.
12. table[i][j] = (*(table+i))[j] = *(*(table+i)+j)
Explanation / Answer
1) False
When you compare the char ch1 and ch2 it compares their ascii value and ascii for C is 67 and for K is 75 and 67 is not greater than or equal to 75 hence false
2) True
When we talk about declaration it means we are just declaring its type , parameters basically the signature of it and we are just telling the compiler that there is a function with xyz name and not giving the description what this function is going to do. But when we define it we are actually writing the code and implementing it, getting memory allocated.
3) False/True
It depends how you are using them.
True - if these are used standalone then both are doing the increment to value of x
False - When we use them in expression both cannot be used interchangeably. x++ does the increment but the increased value is not used i.e. first use the value and then increment. And ++x does the increment first and then value is used.
4) True
Actually the consideration is alphanumeric values are not values instead they are mapping of number to a character.
5) False
Arrays are always passed by reference where the starting address of array is passed.
6) False
We cannot copy the whole array doing so will just make b reference to starting address of a
7) True, as in we can evaluate such expression
Where a will point to address to 0th index and a+i means we are adding i to the address value of 0th index and comparing it to address of ith index.
8) True
Arrays are passed by reference where the address of 0th location.
10) False
&a refers to address of a,
a gives value of a
&*a address of pointer to a.
11) False
The only thing with constant pointer is that once it points to one variable then it cannot point to another.
12) True
All will be referring to the value at location table[i][j], where table is two dimensional array.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.