Programming Test
Description: Practice Tests to increase the Skills covers all concepts of Information Technology, Get prepared for GATE, BCA, B.Sc-IT,M.Sc-IT, MCA Entrance | |
Number of Questions: 25 | |
Created by: Trisha Prashad | |
Tags: Practice Test Practice Tests GATE BCA B.Sc-IT M.Sc-IT MCA Entrance Programming Computer Basics Data Communication & Networks Data Structures Operating System Computer Hardware Information Technology Database |
#include<stdio.h> #include<conio.h> main() { int a[3],i; for(i=0;i<3;i++) a[i]=i++; for(i=0;i<3;i++) printf(" %d",a[i]); }
void main() { int a = 123, b = 456; a ^= b ^= a ^= b; printf("%d %d",a,b); }
void main() { int a=5,b=4,c=10; *((a>b) ? &a : &b) = (a+b>c); printf(%d %d,a,b); }
void f(int *ip) { static int dummy = 5; ip = &dummy; printf(%u,ip); } void main() { int *ip; f(ip); printf(%u,ip); }
void main() { int realarray[2]={1,2}; int *array = &realarray[-1]; int i; for(i=0;i<2;i++) { printf(" %d",*array); array++; } }
What will be the output of the given function?void main() { int a=1,b=2,c=3,d=4; printf("%d",!a?b?!c:!d:a); }
int main() { int a=500,b=100,c=30,d=40,e=19; a+=b-=c*=d/=e%=5; printf("%d %d %d %d %d",a,b,c,d,e); }
main()
{
extern i;
printf("%d",i);
{
int i=20;
printf("%d",i);
}
}
#define Str(x) #x #define Xstr(x) Str(x) #define OP plus void main() { char *opname = Xstr(OP); printf(%s,opname); }
void main() { int i; for (i=5; ++i; i-=3) printf("%d ",i); }
What will be the output of the following program? void main() { int val=1234; int* ptr=&val; printf("%d %d",val,*ptr++); }
What will be the output of the following program?
void func() { printf("Testing...Done"); } void main() { func; func(); }
A signed int bitfield 1-bit wide can only hold the values
What will be the output of the following program? void main() { int i; float a[5]; for (i=0; i<5; i++) a[i] = (printf, ("%d",i/10.0)); for (i=0; i<5; i++) printf("%.1f ",a[i]); }
void main() { int ; _=100; printf("%d",); }
#define big(a,b) a > b ? a : b #define swap(a,b) temp=a; a=b; b=temp; void main() { int a=3,b=5,temp=0; if ((3+big(a,b)) > b) swap(a,b); printf("%d %d",a,b); }
Evaluate the following:
int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7);
What does the following code do?
void afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); printf(“%d”,v); }
What does the line containing "break;" do in the following code?
void afunction() { if(1) { break; afunction(); printf("Error"); } }
void main() { int choice=2; switch(choice) { default: printf("Default1");
case 1: printf("Case1"); break;
default: printf("Default2"); } }
What are the types of variable f2 and p2 in the following declaration?
#define floatptr float * #define int * intptr
floatptr f1,f2; intptr p1,p2;
What would be the output of the following?
#define SQR(x) x*x main() { int a,b=3; a=SQR(b+2); printf(“%d”,a); }
What will be the output of the following program?
void func() { printf("Testing...Done"); } void main() { func; func(); }What would be the output of the following?
main() { int a=10,b; a>=5?b=100:b=200; printf("%d",b); }
What would be the output of the following?
main() { int i=4; switch(i) { default: printf(“A”); case 1: printf(“B”); break; case 2: printf(“C”); break; case 3: printf(“D”); break; } }