Вы находитесь на странице: 1из 6

PROGRAMING FUNDAMENTALS

1.A finite set of steps, each of which may require one or more outputs and may have zero or more operations.
This is called as ________
a. Procedure b. Algorithm c. Program d. Instruction
2.Describing the process step by step is called
a. flow chart b. algorithm c. program d. pseudo code
3.Describing the process using diagrams is called
a. flow chart b. algorithm c. program d. pseudo code
4.Checking to see if our algorithm gives the desired result is called as _______
a. execution b. validation c. dry run d. compilation
5.Making a choice from multiple available options is called as
a. sequence. b. selection c. iteration d. validation
6.Performing repetitive tasks is called as _________________
a. sequence. b. selection c. iteration d. validation
7.The process of removing an error from an algorithm is called as
a. compiling b. debugging c. interpretation d. iteration
8.The characteristic of an algorithm that describes that each instruction is clear and unambiguous is
a. effectiveness b. finiteness c. definiteness d. Input / output
9.The below algorithm
Step 1: Start
Step 2: Read N
Step 3: S = 0
Step 4: REPEAT while N > 0
R = N mod 10
IF R mod 2 THEN
S=S+1
N = N / 10
Step 5: Write (s)
Step 6: Exit

a. Displays the number of odd digits exists in a given number


b. Displays the odd numbers c. Displays the even numbers
d. Displays the number of even digits exists in a given number
10.How many arithmetic operators are there?
a.5 b. 6 c. 3 d. 4
11.If x = 6.0 and y = 7.0 then the value of x / y is
a. -0.857143 b. 0.857143 c. ± 0.857143 d. 1
12.If b is an integer variable, b = 9 / 2; will return a value
a. 4.5 b. 5 c. 4 d. 0
13.The expression , b = 30 * 1000 + 2768 evaluates to
a. 32768 b. -32768 c. 113040 d. 0
14.Suppose x = 8.8 , y = 3.5, z = -5.2. Determine the value of 2 * y + 3 * (x – z)
a. 47 b. 48 c. 49 d. 50
15.Which operator has the highest priority?
a. ++ b. % c. + d. /
16.The operator used for the conditional statement is
a. ! b. ? c. ^ d. $
17.Which of the following is the correct syntax for the conditional statement
a. expression : conditional operator
b. conditional expression : expression 1: expression 2
c. conditional expression ? expression 1 : expression 2
d. conditional expression : expression 1? expression 2
18.Identify the unconditional control structure.
a. do-while b. switch-case c. goto d. if
19.main()
int a = - 4, r, num = 1;
r = a % - 3;
r = (r ? 0 : num * num);
printf (“%d”, r);
}
What will be the output of the program?
a. 0 b. 1 c. negative is not allowed in the mod operands d. -1
20.Which of the following is not a selective control structure?
a. if-else b. if-else-if c. switch-case d. For

21.The general syntax for the FOR loop is


a. for(test condition; expression 2; expression 3) { statements ; }
b. for(expression 1; expression 2; expression 3) { statements ; }
c. for(expression 1; test condition; expression 2 { statements ; }
d. for(expression 1; expression 2; test condition) { statements ; }

22.for ( x = 1; x < 10; x ++)


{
printf(“%d\n”, x);
}
The output of the above program is
a. numbers from 1 to 10 b. numbers from 10 to 1 c. even numbers from 1 to 10
d. odd numbers from 10 to 1

23.The infinite loop using for loop is


a. for ( ; ; ) { …} b. for (test condition ; ; ) { …} c. for ( ;test condition ; ) { …}
d. for ( ; ;test condition ) { …}

24.The comma operator is used in for loop because


a.in order to have multiple expressions which are to be evaluated
b.in order to separate various initializations
c.in order to assign values to variables
d.to declare multi variables

25.for (x = 1; x < = 10; x ++) { …..}


The above code is for
a. loop inversion b. inversion c. printing numbers from 1 to 10 d. printing numbers from 10 to1

26.If the adjacent loops are combined it is called as _________


a. loop jamming b. loop inversion c. adjacent looping d. looping adjacently

27.Identify the wrong statement?


a. for (expr 1;expr 2) b. for (expr 1; expr 3) c. for (;expr ;) d. for (; ;expr 3)

28.Identify the finite loop?


a. for (x = 0; ; x ++); b. for ( x = 0; ; ); c. for (; ; ); d. for (x = 1; x < = 10; x ++);

29.How many x are printed?


for ( x = 0, y = 10; x < y; x ++, y --)
printf(“x”);
a. 10 b. 5 c. 4 d. 15
30.Result of the following program is
main ( )
{
int x = 0;
for ( x = 0; x < 20; x ++)
{
switch (x)
{
case 0 : x + = 5;
case 1 : x + = 2;
case 2 : x + = 5;
default x + = 4;
break;
}
printf(“%d,”,x);
}
}
a. 0, 5, 9, 13, 17 b. 5, 9, 13, 17 c. 12, 17,22 d. 16,21
31.The operator that uses a single operand is a ________ operator.
a. unary b. binary c. ternary d. assignment
32.n ++ requires _________ machine instruction.
a. INC b. PLUS c. INR d. ++

33. p++ executes faster than p + 1 since


a. p uses registers b. single machine instruction is required for p + +
c. multi machine instructions is required for p + + d. p uses more than one register to execute

34. main()
{
int i=5,j=6,z;
printf("%d",i+ + +j);
}
a. 11 b. 10 c. 12 d. 30

35.main()
{
int i =0;j=0;
if(i && j++)
printf("%d..%d",i++,j);
printf("%d..%d,i,j);
}
a. 0..0 b. 1 1 c. -1 -1 d. 1 0

36.What is the output of the following code?


main ()
{
int i = 1;
i=i+2*i++
printf(“%d”, i);
}
a. 5 b. 4 c. 7 d. Run time error

37.The comma operator is used in for loop because


a. in order to have multiple expressions which are to be evaluated
b. in order to separate various initializations
c. in order to assign values to variables d. to declare multi variables

38.The while is
a. test condition controlled statement b. entry controlled loop statement
c. entry controlled condition statement d. test controlled statement

39.The while is executed


a. even if the test condition is false b. at least once even if the test condition is false
c. only if the test condition is true d. only once if the test condition is true

40.Which of the following is an infinite loop?


a. while (1){…} b. while (0) {…} c. while( ) {…} ){…}∝d. while (

41.What is the output of the following program?


# define TRUE 0
main ()
{
while (TRUE)
{
---
}
}
a. The statements in the loop will be executed b. gives an error while executing
c. This wont go into the loop as TRUE is defined as 0 d. the statements in the loop will not be executed
42.The do-while loop is terminated when the conditional expression returns
a. zero b. 1 c. non-zero d. -1

43.Which of the following statements is correct?


a. while loop can be nested b. while cannot be nested
c. one type of loop cannot be nested into another type of loop d. for loop cannot be nested into while loop

44.unsigned char c;
for (c = 0; c ! = 256; c + 2)
printf(“%d”, c);
How many times the loop is executed?
a. 127 b. 128 c. 256 d. infinitely

45.How many x are printed?


for ( x = 0, y = 10; x < y; x ++, y --)
printf(“x”);

a. 10 b. 5 c. 4 d. 15

46.For the following code how many times the printf( ) function is executed?
int x, y;
for (x = 0; x < = 10; x ++)
for (y = 0; y < = 10; y ++)
printf(“x = %d, y = %d\n”, x, y);

a. 121 b. 11 c. 10 d. 132

47.The process of breaking a bigger task into smaller steps, is called _______
a. algorithm b. process c. segmentation d. Divide and conquer

48.The activity that does not form the building block of an algorithm.
a. sequence b. selection c. iteration d. parallel computing

49.The below algorithm


Step 1: I = 0, P = 1
Step 2: Repeat while I < N
P=P*X
I=I+1
Step 3: Return P

a. evaluates Power(X, N) b. evaluate Power(N, X) c. evaluates square (X, N) d. evaluates square(N, X)

50.The efficiency of an algorithm depends on which of the following parameters.


a. Time and size b. Time and space c. Space and size d. only time

Q.No. Correct Ans Your Ans


1 B C
2 B B
3 A A
4 C U
5 B B
6 C C
7 B U
8 C U
9 A U
10 A A
11 B U
12 C C
13 B A
14 A C
15 A U
16 B B
17 C D
18 C C
19 A U
20 D D
21 B U
22 A A
23 A C
24 A A
25 C A
26 A U
27 B D
28 D D
29 B D
30 D U
31 A A
32 C U
33 B U
34 A C
35 A U
36 B B
37 A A
38 B B
39 C C
40 A C
41 C U
42 A B
43 A U
44 D D
45 B U
46 A U
47 A D
48 D U
49 A U
50 B U

Вам также может понравиться