Академический Документы
Профессиональный Документы
Культура Документы
Code Obfuscation
-Preliminary Round
Team name :
INSTRUCTIONS:
Question paper has got 25 questions.
Question paper has various marks depending on the toughness of the question.
‘Predict the output’ questions may have errors. If so you have to specify the errors and
correct only the part that causes the errors.
Star questions carry 4 marks each and will be considered to break ties.
1
TITAN ’IQ
int z,x=5,y=-10,a=4,b=2;
Select the statement which will EXACTLY reproduce the line of text above.
int b=1;
if(b==1.0)
float a=1.1;
if(1.1==a)
printf("Bye :h"); }
(gamma<Size) ?
printf("%c",(gamma==2)||(gamma==3)||(gamma==9) ?
2
TITAN ’IQ
int main() {
5.) Predict the output. If any error, debug and predict the output.
main(){
int x=5,y=6,a;
a=++x+--y*--x*x++*--x/2;
b=1+++a + a++;
printf("%d %d %d",a,x);
??=include<iostream>
??=include<stdio.h>
??=include<conio.h>
int main()??<
int a??(??)=??<1,2,3,4,5??>;
cout<<??-a??(2??);
getch();??>
3
TITAN ’IQ
printf("%d ",*((int*)no+last));
last++;
void main() {
int a[]={0,1,2,3,4,5,6,7,8,9};
char ch[]="hello";
if(ch<:2:>==121??!??!ch<:1:>==101)
<%cout<<"hai";%>
else
cout<<"bye";
getch();??>
4
TITAN ’IQ
(t < m * m) ? print(m,t+1,c) : 0;
int main(void) {
print(10,0,0);}
10.) Predict the output when i.) a=1 ii.) a=2 iii.) a=3.
main(){
int a;
char *M;
scanf(M="%d",&a);
cout<<a<<" "<<M<<endl;
switch(a) {
default:
cout<<"hello1"<<endl;
case 1:
if(a==1) {
cout<<"1"<<endl;
break;
cout<<"2"<<endl;
cout<<"3"<<endl
case 2:
cout<<"hello";
cout<<"bye"<<endl;}
5
TITAN ’IQ
void display(){
printf("TITAN");
return;
int main(){
void (*print)();
print=display;
print();
(*print)();
return 0;
int shift;
if (u == 0 || v == 0)
return u | v;
u >>= 1;
v >>= 1;
u >>= 1;
do {
6
TITAN ’IQ
v >>= 1;
if (u < v) {
v -= u;
} else {
int diff = u - v;
u = v;
v = diff;
v >>= 1;
} while (v != 0);
void main(){
int a=0;
int b=3,c;
c=++a,a++,b+=2;
printf("%d ",bigger(c,b));
class N
int a;
public:
N() {
N(5); }
7
TITAN ’IQ
N(int a) {
a=this.a;}
void print() {
cout<<"A: "<<a<<endl; }
};
int main(){
N n,n1(10);
n.print();
n1.print();}
14.) Predict the output of the following snippet in i)C & ii)C++. If you feel the compiler might throw any
errors or warnings, mention them.
int fn()
int a;
char ch[]="ajsjas";
a=ch;
printf(”hello world”);
15.) Predict the output.If you feel the compiler might throw any error or warning, mention it.
int main()
int a=5,b=10;
if(10=b)
printf("hello");
return 0;
8
TITAN ’IQ
printf(" world!!!");
main(argc, argv)
int argc;
char **argv;
9
TITAN ’IQ
printf("%c ",_0);
_0++;
int main() {
_('O','o','O');
return 0;
int main() {
int a;
a=1,2;
cout<<"a:"<<a<<endl;
int b, c;
cout<<"a:"<<a<<"b:"<<b<<"c:"<<c<<endl;
return 0;
int main() {
int a=1,b=2,x=5,y=4;
10
TITAN ’IQ
a -= b;
a += b;
x -= y;
x += y;
int main(){
int val[]={0,1,2,3,4,5,6,7,8,9,10};
2*3*4*5/100;
"hello world";
1,val[4]*=10;
val[0]&&++val[3]||++val[1];
int *ptr=val;
void main()
int matrix[2][3]={{1,2,3},{4,5,6}};
printf("%d %d %d\n",*(*(matrix)),*(*(matrix+1)+2),*(*matrix+1));
printf("%d %d %d",*(matrix[0]+2),*(matrix[1]+1),*(*(matrix+1)));
11
TITAN ’IQ
struct A {
int b;
struct A {
int b;
struct B *nextB;
}tempB;
struct A nextB;
}tempB;
int main() {
tempB.nextB.b=5;
printf("%d",tempB.nextB.b); }
void main()
int a=2,b=3,c=4,d=5,e;
printf("%d",e);
int main(){
unsigned x=80,y=5,z;
12