forum_image

Discussion Forum

Interative Forum for discussing any query literally to UGC-NET Computer Science, GATE Computer Science and Computer Sciene and Technology in general.

ugc_net image

UGC-NET Computer Science

Correspondence Courses and Test Series to prepare for UGC-NET computer science and applications

GATE image

GATE

MCQs, Lecture Notes, Ebooks for GATE preparation

freestuff image
jobs image

Jobs Newsfeed

Timely information of various Recruitments.

NextPrev

MCQs C++ |UGC-NET|GATE|Computer Science

1.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.free()
View/Hide Ans
Explanation
2.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);
B.++(int*)ptr;
C.ptr = ptr + sizeof(myArray);
D.ptr = ptr + sizeof(ptr);
View/Hide Ans
Explanation
3.main() { char *ptr = Hi How r U?; *ptr++; printf(%s\n,ptr); ptr++; printf(%s\n,ptr); }
A.Empty string
B.Compile error
C.Hi How r U? i How r U?
D.Hi How r U? Hi How r U?
View/Hide Ans
Explanation
4.int testarray[2][2][2] = {11, 22, 33, 44, 55, 66, 77, 88}; What value does testarray[1][1][0] in the sample code above contain?
A.55
B.77
C.88
D.11
View/Hide Ans
Explanation
5.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.22,13,13,13
View/Hide Ans
Explanation
6.When reallocating memory if any other pointers point into same piece of memory do these pointers-
A.need to be readjusted
B.they get readjusted automatically
C.C does it on behalf of user
D.none of above
View/Hide Ans
Explanation
7.7. Which of these are correct method of declaring pointer? i. char *p, ii. char* p, iii. char * p, iv. char*p.
A.I only
B.I and II
C.I, II and III
D.all of above
View/Hide Ans
Explanation
8.What is the output of this code main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++) { printf(" %d ",*p); ++p; } }
A.2 2 2 2 2 2 3 4 6 5
B.2 2 2 2 2 3 4 6 5
C.2 2 2 2 3 4 6 5
D.2 2 2 2 3 4 6 5
View/Hide Ans
Explanation
9.What will be the output of following code Int main(void) { int *p =NULL; int *c =(int*)malloc(sizeof(p)); printf(" %0x" &c); return 0; }
A.Some address
B.Blank Screen
C.Some integer value
D.Garbage value
View/Hide Ans
Explanation
10.What is the output of the following program? void main() { int *ptr =55; clrscr(); printf("%d", ++(ptr)); }
A.54
B.55
C.56
D.some address
View/Hide Ans
Explanation


Author Does Not claim of any answer these answers are as per expert opinion


Pages: 1 2 3 4 5 6 7 8 9