Fundamentals of Programming: Problems #3
Fundamentals of Programming: Problems #3
Fundamentals of Programming: Problems #3
Fundamentals of
PROGRAMMING
Problems #3
PROGRAMMING Everywhere P1
Problems (3)
1. What will be the output of the following C# code?
a) No output
b) hello
c) hello printed infinite times
d) Code will give error as expression syntax
a) 1.1
b) 0.1
c) 0.1 0.2 0.3 0.4 0.5
d) None of the mentioned
a) Output of code is 5 10
b) Output is 5 5 5 5
c) Print 5 infinite times
d) None of the mentioned
1 M.A.S
PROGRAMMING Everywhere P1
a) 1 2 3 4 5 6 7 8 9
b) 25
c) 1
d) Run time error
2 M.A.S
PROGRAMMING Everywhere P1
1. * * * * *
2. * * * *
3. * * *
4. * *
5. *
6. static void Main(string[] args)
7. {
8. int i,j;
9. /* Add code here */
10.
11. }
a)
b)
c)
d)
a) for( ,’0′,)
b) for( ;’0′; )
3 M.A.S
PROGRAMMING Everywhere P1
c) for( ;’1′; )
d) for( ,’1′, )
a) i = 0, j = 1;
b) i = 1, j = 0;
c) j = 0;
d) None of the mentioned
A.
do;
statement;
}while (condition);
B.
do(condition)
statement;
}while;
C.
do
4 M.A.S
PROGRAMMING Everywhere P1
statement;
}while (condition)
D.
do
statement;
}while (condition);
a)
1 2 3 4
1 2 3 4 5
b)
1 2 3
1 2 3 4
c)
1 2 3 4 5
1 2 3 4
d)
5 M.A.S
PROGRAMMING Everywhere P1
1 2 3 4 5
1 2 3 4 5
a) 1 2 3 4 5 6 7 8 9 10
b) 0 2 4 6 8 10 12 14 16 18 20
c) 0 2 4 6 8
d) 0 2 4 6 8 10
a)
6 M.A.S
PROGRAMMING Everywhere P1
b)
c)
d)
a) 3245
b) 2354
c) 2345
d) 5423
7 M.A.S
PROGRAMMING Everywhere P1
9. }
a) 0.05f
b) 1.50f
c) -0.04999995f
d) 1.50f
a) -127 to +127
b) 0 to 127
c) 1
d) Infinite loop condition
8 M.A.S
PROGRAMMING Everywhere P1
a) 0.05
b) -0.05
c) 0.95
d) -0.04999995
a) 5 10 15 20 25 30 35 40 45 50
b) 5 25
c) 5 11 16 21 26 31 36 41 46 51
d) 5 30
23. The C#.NET code snippet given below generates ____ numbers series as output?
int i = 1, j = 1, val;
while (i < 25)
{
Console.Write(j + " ");
val = i + j;
j = i;
i = val;
}
A.Prime
9 M.A.S
PROGRAMMING Everywhere P1
B. Fibonacci
C. Palindrome
D.Odd
E. Even
11 M.A.S