DXC Output Based Questions [Pseudo Code]
Clik To Join Telegram To Stay Updated
1. What will be the output of following code :
#define clrscr() 100; main(){
clrscr();
printf(%d\n\t, clrscr());
}
A. 100
B. 10
C. Compile Error
D. Runtime Error
Ans. A
2. What will be the output of following code :
int main()
{
void vpointer;
char cHar = g,cHarpointer = GOOGLE;
int j = 40;
vpointer = &cHar;
printf(“%c”,(char)vpointer);
vpointer = &j;
printf(“%d”,(int )vpointer);
vpointer = cHarpointer;
printf(“%s”,(char)vpointer +3);
}
A. 40
B. 100
C. ERROR
D. Warning
Ans. C
3. What will be the output of following code :
int main(){
int i;
if(true)
printf(“work”);
else
printf(“not work”);
return 0;
}
A. work
B. not work
C. compiler error
D. runtime error
Ans. A
4. What will be the output of following code :
int main()
{
if(printf(“0”))
printf(“inside if block”);
else
printf(“inside else block”);
return 0;
}
A. inside else block
B. 0
C. 0inside if block
D. Error – If can not have print statement
Ans. C
5. What will be the output of following code :
int main()
{
int a = NULL – true;
printf(“%d”,a);
return 0;
}
A. -1
B. Garbage value
C. 0
D. Error
Ans. -1
6. What will be the output of following code :
main()
{
extern int iExtern;
iExtern = 20;
printf(%d,iExtern);
}
A. 2
B. 20
C. Error
D. Warning
Ans. C