Time Left - 04:00 mins
RRB JE (IT) : C language + C++ language Quiz 1
Attempt now to get your rank among 540 students!
Question 1
The friend functions are used in situations where:
Question 2
Assume that we have constructed functions for both base class and derived class. Now consider the declaration in main( ). Base ∗ P = New Derived; in what sequence will the constructor be called?
Question 3
#include <stdio.h>
int f(char *p)
{
return (printf("%s\n",p));
}
void main(){
char str[20];
printf("Enter a string ");
scanf("%s",str);
printf("result = %d",f(str));
}
If entered string is “coding is good job”, what will be result ,result=?
int f(char *p)
{
return (printf("%s\n",p));
}
void main(){
char str[20];
printf("Enter a string ");
scanf("%s",str);
printf("result = %d",f(str));
}
If entered string is “coding is good job”, what will be result ,result=?
Question 4
Match the groups:
Question 5
What will be output?
#include <stdio.h>
void main(){
int *ptr1,* ptr2, a, b, c, d;
ptr1= (int*) malloc (8);
a=ptr1;
free (ptr1);
b=ptr1;
printf ("%d ,%d ,",ptr1,a-b);
ptr2=(int*) malloc (16);
c=ptr2;
realloc(ptr2,0);
d=ptr2;
printf(" %d, %d ",ptr2,c-d);
}
#include <stdio.h>
void main(){
int *ptr1,* ptr2, a, b, c, d;
ptr1= (int*) malloc (8);
a=ptr1;
free (ptr1);
b=ptr1;
printf ("%d ,%d ,",ptr1,a-b);
ptr2=(int*) malloc (16);
c=ptr2;
realloc(ptr2,0);
d=ptr2;
printf(" %d, %d ",ptr2,c-d);
}
- 540 attempts
- 0 upvotes
- 5 comments
Tags :
GATE & PSU CSGeneralJun 28GATE & PSU CS