Programming (C/C++)
Description: Test your C skill in programming language for mca entrance and campus placements by free online preparation and practice paper tests | |
Number of Questions: 25 | |
Created by: Varsha Mane | |
Tags: C Skills Test Java Skill Test DBMS Oracle PHP Computer Application Placement Papers MCA Entrance Programming Fundamentals of Computer Programming |
With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?
int z,x=5,y=-10,a=4,b=2; z = x++ - --y * b / a; What will be the value of z in the sample code given above?
void *ptr; myStruct myArray[10]; ptr = myArray; Which of the following is the correct way to increment the variable "ptr"?
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 be the output when the sample code given above is executed?
What is the difference between declaration and definition of a variable?
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?
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?
11 ^ 5 What is the output of the above operation?
Which function will read a specified number of elements from a file?
"My salary was increased by 15%!" Select the statement which will EXACTLY reproduce the line of text above.
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?
void myFunc (int x) { if (x > 0) myFunc(--x); printf(%d, , x); } int main() { myFunc(5); return 0; } What will the output of the above code after execution?
int x[] = { 1, 4, 8, 5, 1, 4 }; int *ptr, y; ptr = x + 4; y = ptr - x; What is the value of y in the sample code given above?
#define MAX_NUM 15 Referring to the sample above, what is MAX_NUM?
What is a proper method of opening a file for writing as a binary file?
Which one of the following will turn off buffering for stdout?
Which of following functions is the correct choice for moving blocks of binary data which are having arbitrary size and position in memory?
int x = 2 * 3 + 4 * 5; What will be the value of x in the sample code?
time_t t; Which of the following statements will properly initialize the variable t with the current time from the sample above?
int var1; If a variable has been declared with file scope, as above, can it safely be accessed globally from another file?
Which kind of language is language C?
Which one of the following provides conceptual support for function calls?
int x = 0; for (x=1; x<4; x++); printf(x=%dn, x); What will be the output of the sample code given above?
void * array_dup (a, number, size) const void * a; size_t number; size_t size; { void * clone; size_t bytes; assert(a != NULL); bytes = number * size; clone = alloca(bytes); if (!clone) return clone; memcpy(clone, a, bytes); return clone; }
The function array_dup(), defined above, contains an error. Which of the following options correctly analyses it?
int i,j; int ctr = 0; int myArray[2][3]; for (i=0; i<3; i++) for (j=0; j<2; j++) { myArray[j][i] = ctr; ++ctr; } What is the value of myArray[1][2]; in the sample code?