Thursday 6 February 2014

Test your Programming skills

PONJESLY COLLEGE OF ENGINEERING
TEST YOUR C- SKILS
  1. What will be the output of the following program?
#include<stdio.h>
int x= 40 // Global Declaration
void main()
{
int x=20; // Local Declaration
printf(“\n%d”, x);
}
  1. What will be the output of the following program?
#include<stdio.h>
void main()
{
int x= 40 //Local Variable
{
int x=20; // Most Local variable
printf(“\n%d”, x);
}
printf(“\n%d”, x);
}
Answers:
  1. 20, Whenever there is a conflict between a local variable and a global variable, the local variable will get the priority.
  2. 20 40, Now both are local variables. In this case the most local variable will get the priority.
By,
IT Department,PJCE


LOGICAL MATHS
INSERT THE MISSING NUMBER

1. 8 15 34
12 6 18
40 5 ?


a) 45 b) 30 c) 60 d) 35


2. 175 (576) 463
192 ( ) 357


a) 288 b) 82 c) 330 d) 357


3. 514, 258, 130, 66?


a) 34 b) 33 c) 36 d) 38




4. 15 7 10 12
25 5 7 ?
16 8 4 20


a) 27 b) 13 c) 23 d) 47


5. 8,17,33,67,133, ?


a) 264 b) 265 c) 266 d) 267









ANSWERS:


  1. b
(15*2) + (8/2) =34, (6*2) + (12/2) =18 Hence (5*2) + (40/2)=30
  1. c
See the difference between the numbers outside the brackets and multiply the result by 2.
  1. a
514/2 +1=258, 258/2 +1=130, 130/2 +1=66, 66/2 +1=34
  1. c
See the horizontal rows. 15+7-10= 12. Therefore 25+5-7=23
  1. d
8*2+1=17, 17*2-1=33, 33*2+1=67, 67*2-1=133,133*2+1=267.
By
JEYA PRABHA.R

IV IT  

No comments:

Post a Comment