Anda di halaman 1dari 14

Knight Coders 1

Aranya 2008

KNIGHT CODERS
P R E L I M N A RY R O U N D

Team Name:_____________________________

Members Details:

Member 1: Member 2: Member 3:


Name:____________________ Name:____________________ Name:____________________
_________ _________ _________

College:__________________ College:__________________ College:__________________


_________ _________ _________

Contact Contact Contact


No.:___________________ No.:___________________ No.:______________________

email email email


address:_________________ address:_________________ address:__________________
_

Rules:

1. When question does not mention compiler take default as G++/GCC.


2. Marking Scheme: +4 -1
3. Cutting, erasing, Overwriting of answers will count as a wrong answer and you will
be rewarded -1 for it.
4. 10 teams have already earned a place into the finals via iKnight Coders.
5. The prelims will select the remaining 30 teams that enter the mains round and battle out
for the prize.
6. Decision of the organizers shall be final in all cases.
Knight Coders 2
Aranya 2008

1.

Q1. Consider the following declaration: char const *p = 'd';


Which of the following is not a permissible operation

(a) *p++ (d) All


(b) ++p (e) Other:___________________________
(c) (*p)++

Q2. What is the output of the following program?

#include<stdio.h>

#include<conio.h>

#define putchar(c) printf("%c",c)


int main()
{
char s='c';
putchar (s);
}

a) c d) Execution error
b) 99 e) Other:________________________ ______
c) Compilation Error

Q3) Consider the following program?

#include<stdio.h>

#include<conio.h>

int main()

printf("%d",printf("ABC\\"));

getch();
Knight Coders 3
Aranya 2008

(a) ABC\\ (d) ABC\3


(b) 1 (e)Other:__________________________
(c) ABC\4

Q4) What will be the average angle at center? Assume that the intersection point of
circle as intersection point.
(a)10 degree (d)Cant be determined
(b)18 degree (e)None of them
(c)60/7 degree
b) 6/(6^7)
Q5) What will be probability of getting word ARANYA, c) 3/(6^6)
if 6 letters are randomly picked from A, C, N, R, S, Y. d) 1/(4^6)
Repetition of letter is allowed e) None of these
a) 6!/(6^6)

Q6) What is the output of the following program?

#include<conio.h>

#include<stdio.h>

int main()

int i;

char a[]="\0";

if(printf("%s\n",a))

printf("Ok here \n");

else

printf("Forget it\n");
Knight Coders 4
Aranya 2008

getch();

}
(a) Forget it (e)
(b) Ok here Other:________________________________________________
(c) 0 _____
(d) Execution Error

Q7) What is the output of the following program?

#include<stdio.h>

#include<conio.h>

int compute(int n)

if(n>0)

n=compute(n-3)+compute(n-1);

return(n);

return(1);

int main()

printf("%d",compute(5));
Knight Coders 5
Aranya 2008

getch();

}
a) 6 e)
b) 9 Other:________________________________________________
c) 12 ___________
d) 13

Q8) What will be the output of the following code?

#include<stdio.h>

#include<conio.h>

int main()

int i;

for(i=0;i<3;i++)

int i=100;

i--;

printf("%d..",i);

getch();

}
(a)0..1..2.. (d)99..99..99..
(b)99..98..97.. (e)Other:______________________________
(c)100..100..100.. ___
Knight Coders 6
Aranya 2008

Q9) what is the output of the given code?

#include<conio.h>

#include<stdio.h>

int main()

int c=- -2;

printf("c=%d",c);

(a) compilation error (d) 2


(b) garbage value (e) Other __________________________
(c) -2

Q10) abcd
*2
__________
edcba
Find the value of d

a)6 d)8
b)1 e)Other:_______________________
c)3

Q11 ) Compare two statements:


A: In a survey 74% of Indians like Games, while 68% play Games. What percentage
of Indians play as well as like games?
B: 42%
a) A>B d) can’t be said anything
b) A<B e) None of these
c) A=B
Knight Coders 7
Aranya 2008

Q12) A fair coin is tossed 10 times. Find the probability that 2 heads don’t occur
simultaneously.
a)1/2^4 d)1/2
b)1/2^5 e)None of these
c)1/2^3

Q13) Given P,Q are primes than


Number of divisors of (P^2).Q
a) 2 d) 8
b) 4 e) None of these
c) 6

Q14) What will be output of the following program?

#include<stdio.h>

#include<conio.h>

int main()

int a[]={10,20,30,40,50};

int *p;

p= (int*)((char *)a + sizeof(int));

printf("%d",*p);

getch();

}
a) 10 d) Compilation Error
b) 20 e)
c) 30 Other:______________________________________________

Q15) What is the output of the following section of code ?


Knight Coders 8
Aranya 2008

#include<stdio.h>

#include<conio.h>

int main()

int x=10,y=15;

x=x++;

y=++y;

printf("%d %d\n",x,y);

getch();

}
a) 10 15 d) 11 15
b) 11 16 e) Other _________________________________
c) 10 16

Q 16) A polygon has 54 diagonals. Find the number of sides.


a) 10 d) 8
b) 14 e) None
c) 12

Q17) What will be the output of the following code ?

#include<conio.h>

#include<stdio.h>

int main()

int a=1;
Knight Coders 9
Aranya 2008

a = a + + + + + + + + + + + + + + + +
+ + + + - + + - + a;

printf ("a=%d\n",a);

}
a) 2 e) Other _______________
b) Compilation Error __________________________________
c) Execution Error
d) 0

Q18) What will be the output of the following code ?

#include<conio.h>

#include<stdio.h>

int main()

int a=50;

a=++a;

printf(“%o”,a);

}
a) 51 d) 50
b) 61 e) Other
c) 63 ______________________________________________

Q19) What will be the output of the following code ?

#include<conio.h>

#include<stdio.h>
Knight Coders 10
Aranya 2008

int main()

unsigned int i=-1;

printf("%d\n",i);

}
(a) Compilation Error (d) 1
(b) Runtime Error (e)Other:______________________________
(c) -1 ___

Q20) What will be the output of the following file(try.c) ?

#include<conio.h>

#include<stdio.h>

int main()

int *j=(int *)01000,a[1]={01000};

j=a;

printf("%d",*j);

}
(a) Compilation error (d)512
(b) 1000 (e)Other:_____________________________________________
(c)01000 ____

Q21) Which of the following statement can be used to terminate the program at s?

#include<conio.h>
Knight Coders 11
Aranya 2008

#include<stdio.h>

int main()

int x,y,z;

x=2;

y=5;

z=x+++y;

printf("%d %d %d",x,y,z);

}
(a) Compilation Error (d)3 6 8
(b) 2 6 8 (e) None of the above
(c) 3 5 7

Q 22. The sum of reciprocal and fraction equals 85/18.Find the fraction.
a)2/6 d)4/9
b)2/3 e)None
c)2/9

Q23) The sum of the third and the ninth term of an AP is 10.Find a possible sum of
first 11 terms of this A.P.
a)55 d)None of these
b)44 e)All of the above
c)66

Q24) If a,b,c,d are proportional,then (a-b)(a-c)/a=


a)a+c+d b)a+d-b-c
c)a+b+c+d d)Cant be determined
e)Other

Q25) What will be the output of the following code ?

#include<conio.h>
Knight Coders 12
Aranya 2008

#include<stdio.h>

# define swap(a,b) temp=a; a=b; b=temp;

int main( )

int i, j, temp;

i=5;

j=10;

temp=0;

if( i > j)

swap( i, j );

printf( "%d %d %d", i, j, temp);

}
a) 10 5 10 d) Compilation error
b)10 5 5 e) Other: ________________________________
c) 10 0 0

Q26) What will be the output of the following code

#include<conio.h>

#include<stdio.h>

# define swap(a,b) temp=a; a=b; b=temp;

int main()

{
Knight Coders 13
Aranya 2008

float me = 1.1;

double you = 1.1;

if(me==you)

printf("I love U");

else

printf("I hate U");

(a) I love U (d) 1


(b) Compilation Error (e) Other:_____________________________________
(c) I hate U

Q27) If we declare a a variable int p[1]={0,1,2,3,4}, what will happen?

(a) Will compile (d) Will give execution error


(b) Will not compile (e)Other:_________________________
(c) Give Warning but compile

Q28) A cistern is normally filled in 5 hours. However it takes 6 hrs when there is a
leak in its bottom. If the cistern is full, in what time should cistern be empty.
a)6h b)5h
c)30h d)15h
e)Other

Q29) What is the output of the following program?

#include<conio.h>

#include<stdio.h>
Knight Coders 14
Aranya 2008

int main()

static int i=5;

if(--i){

main();

printf("%d ",i);

(a) Compilation Error (d)Infinite Loop


(b)0 0 0 0 0 (e)Other:______________________________
(c)0 0 0 0 ____________

Q30) A sum of money becomes 7/4 of itself in 6 years at a certain rate of simple
interest. Find the rate of interest
a)12% b)12(1/2)%
c)8% d)14%
e)Other

Anda mungkin juga menyukai