Re: 100 Multiple choice questions in C(New Question?) Which one of the following Standard C functions can be used to sort a string array? Choice 1 qsort (Ans) Choice 2 sort Choice 3 quicksort Choice 4 asort Choice 5 There is no Standard C function for such a sort.
int a[100]; int *p=a; for(;a<p+100; a++) *a=0; a=p; Which one of the following describes the error in the sample code above? Choice 1 The initialization of p from a is not allowed since the compiler believes that they have differing types. There should be whitespace between the star and p to achieve the desired effect. Choice 2 It is not permissible to omit the initializer of a for loop. Choice 3 The address of the first element not in the array a is p + 100 * sizeof(int), not p + 100. Choice 4 It is not permissible to alter the value of a. (Ans) Choice 5 The iterator of the for loop should be a += sizeof(int) instead of a++.
Re: 100 Multiple choice questions in C(New Q?) #include <stdlib.h> int main() { struct x {double d; int i; char c;}; struct x *xp=(struct x*)calloc(1, sizeof(struct x)); } Referring to the above sample code, what are the values of the structure members pointed to by "xp" after the "calloc"? Choice 1 undefined,undefined,undefined Choice 2 1.0,1,'\01' Choice 3 undefined,0,'\0' (Ans) Choice 4 0.0,0,'\0' Choice 5 0e0,0,'\0'
I am not that sure that is the answer. By definition an lvalue is a "value" that can take part in an assigment on the left side. More particular, the lvalue is a "writable" value, and an rvalue is a "readable" value. Nothing to do with pointers. for example: (1+2) its a rvalue -> we could never write (1+2) = 4 :P but this is a lvalue but also a rvalue int & something() { static int something = 0; return something; } something() = 3; // something() as lvalue int some_thing = something(); // something() as rvalue
Code: // Oki, but what pointer reference do we have here? const int anything = 12; int some_thing = anything; some_thing = 0; // lvalue = rvalue // Consider that we can use a pointer to point to an rvalue also const char * pszSomething = "Hello"; // Considering the statement above, what would be the difference between rvalue and lvalue // if this is the definition of an lvalue?! That's why I think the choice "All lvalues can be used on the right side of an assignment statement. (Ans--?)" was marked as the answer, because is the most plausible of all. This means that If a value is a lvalue it can also be used as an rvalue. And about the function int & something(); I used in the previous example,I should say that not all the references are "translated" by the compiler into pointers.In this case, it should not. But that's debatable depending on what do you mean by "pointer". If I am wrong correct me please. Cheers
Re: 100 Multiple choice questions in C !!i need answers!! wud u plz send me answers for these 100 mcqs at the undersigned-as soon as possible!! guneet2027@gmail.com
can anyone please provide me the ans of the above question from 1 to 100 on mishra.vaibhav00@gmail.com or vaibhavmishra9235@gmail.com or vaibhavmishra0@gmail.com it's urgent
hello plz mail me answers at vartika.mishra27@gmail.com im making a website on online examination as my project so i need ans of the question... is the option mark as [ans] is the right answer plz tel me so that i can complete my website...