
Plz answer the following questions..... TECHNICAL - C
/question number 1/ Code: int z,x=5,y=-10,a=4,b=2; z = x++ - --y * b / a; What number will z in the sample code above contain? a. 5 b. 6 c. 10 d. 11 e. 12
/question number 2/ With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?
a. unalloc() b. dropmem() c. dealloc() d. release() e. free()
/question number 3/ Code: void *ptr; myStruct myArray[10]; ptr = myArray; Which of the following is the correct way to increment the variable "ptr"? a. ptr = ptr + sizeof(myStruct); [Ans] b. ++(int*)ptr; c. ptr = ptr + sizeof(myArray); d. increment(ptr); e. ptr = ptr + sizeof(ptr);
/question number 4/ Code: char* myFunc (char *ptr) { ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = myFunc (x); printf ("y = %s \n", y); return 0; } What will print when the sample code above is executed? a. y = HELLO b. y = ELLO c. y = LLO d. y = LO e. x = O
/question number 5/
Code:
struct node nPtr, *sPtr; / pointers for a linked list. */
for (nPtr=sPtr; nPtr; nPtr=nPtr->next)
{
free(nPtr);
}
The sample code above releases memory from a linked list. Which of the choices below accurately describes how it will work?
a. It will work correctly since the for loop covers the entire list. b. It may fail since each node "nPtr" is freed before its next address can be accessed. c. In the for loop, the assignment "nPtr=nPtr->next" should be changed to "nPtr=nPtr.next". d. This is invalid syntax for freeing memory. e. The loop will never end.
/question number 6/ What function will read a specified number of elements from a file?
a. fileread() b. getline() c. readfile() d. fread() e. gets()
/question number 7/ "My salary was increased by 15%!" Select the statement which will EXACTLY reproduce the line of text above. a. printf("\"My salary was increased by 15/%!\"\n"); b. printf("My salary was increased by 15%!\n"); c. printf("My salary was increased by 15'%'!\n"); d. printf("\"My salary was increased by 15%%!\"\n"); e. printf("\"My salary was increased by 15'%'!\"\n");
/question number 8/ What is a difference between a declaration and a definition of a variable?
a. Both can occur multiple times, but a declaration must occur first. b. There is no difference between them. c. A definition occurs once, but a declaration may occur many times. d. A declaration occurs once, but a definition may occur many times. e. Both can occur multiple times, but a definition must occur first.
/question number 9/ int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What value does testarray[2][1][0] in the sample code above contain? a. 3 b. 5 c. 7 d. 9 e. 11
/question number 10/ Code: int a=10,b; b=a++ + ++a; printf("%d,%d,%d,%d",b,a++,a,++a); what will be the output when following code is executed a. 12,10,11,13 b. 22,10,11,13 c. 22,11,11,11 d. 12,11,11,11 e. 22,13,13,13

1) 5
2) free()
3) By providing function by user can increment that pointer.
4) y = LO
5) It may fail since each node "nPtr" is freed before its next address can be accessed.
6) fread()
7) printf("\"My salary was increased by 15%%!\"\n");
8) According to C++, Both can occur multiple times, but a declaration must occur first. According to C, A definition occurs once, but a declaration may occur many times.
9) 11
10) 22,13,14,14
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.