1
GATE CSE 2018
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C program:
#include< stdio.h >
void fun1(char *s1, char *s2){
  char *tmp;
  tmp = s1;
  s1 = s2;
  s2 = tmp;
}
void fun2(char **s1, char **s2){
  char *tmp;
  tmp = *s1;
  *s1 = *s2;
  *s2 = tmp;
}
int main(){
  char *str1 = "Hi", *str2 = "Bye";
  fun1(str1, str2); printf("%s %s ", str1, str2);
  fun2(&str1, &str2); printf("%s %s", str1, str2);
  return 0;
}
The output of the program above is
A
Hi Bye Bye Hi
B
Hi Bye Hi Bye
C
Bye Hi Hi Bye
D
Bye Hi Bye Hi
2
GATE CSE 2015 Set 1
MCQ (Single Correct Answer)
+2
-0.6
What is the output of the following C code? Assume that the address of x is 2000 (in decimal) and an integer requires four bytes of memory.
int main () { 
unsigned int x[4][3] = 
          {{1,2,3},{4,5,6},{7,8,9},{10,11,12}}; 
          printf(“%u, %u, %u”, x+3, *(x+3), *(x+2)+3); 
}
A
2036, 2036, 2036
B
2012, 4, 2204
C
2036, 10, 10
D
2012, 4, 6
3
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{ 
   static int a = 1; /* Line 1 */
   prtFun();
   a + = 1;
   prtFun();
   printf("\n %d %d ", a, b);
}
void prtFun(void)
{ 
   static int a=2;   /* Line 2 */
   int b=1;
   a+ = ++b;
   printf("\n %d %d ", a, b);
}
What output will be generated by the given code segment?
A
$$\eqalign{ & 3\,\,1 \cr & 4\,\,1 \cr & 4\,\,2 \cr} $$
B
$$\eqalign{ & 4\,\,2 \cr & 6\,\,1 \cr & 6\,\,1 \cr} $$
C
$$\eqalign{ & 4\,\,2 \cr & 6\,\,2 \cr & 2\,\,0 \cr} $$
D
$$\eqalign{ & 3\,\,1 \cr & 5\,\,2 \cr & 5\,\,2 \cr} $$
4
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{ 
   static int a = 1; /* Line 1 */
   prtFun();
   a + = 1;
   prtFun();
   printf("\n %d %d ", a, b);
}
void prtFun(void)
{ 
   static int a=2;   /* Line 2 */
   int b=1;
   a+ = ++b;
   printf("\n %d %d ", a, b);
}
What output will be generated by the given code segment if:
Line 1 is replaced by auto int a = 1;
Line 2 is replaced by register int a = 2;
A
$$\eqalign{ & 3\,\,1 \cr & 4\,\,1 \cr & 4\,\,2 \cr} $$
B
$$\eqalign{ & 4\,\,2 \cr & 6\,\,1 \cr & 6\,\,1 \cr} $$
C
$$\eqalign{ & 4\,\,2 \cr & 6\,\,2 \cr & 2\,\,0 \cr} $$
D
$$\eqalign{ & 4\,\,2 \cr & 4\,\,2 \cr & 2\,\,0 \cr} $$
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12