Professional Documents
Culture Documents
Question - 1
C
12 17
10 17
12 20
10 20
Question - 2
c
integer
character
boolean
array
Question - 3
c
Decision-Making
iteration
recursion
Object Oriented
Programming
Question - 4
c
Decision-Making
iteration
recursion
none of
these
Question - 5
c
22
11
10
none of
these
Question - 6
c
(10 -5)
(6 -5)
(5 -5)
Question - 7
c
Loops
forever
Question - 8
c
2,1,8
4,1,8
4,4,8
2,4,8
Question - 9
c
integer
boolean
float
character
Question - 10
c
410
410.4
411.4
411
Question - 11
c
25
13
26
52
Question - 12
c
4063
20
10
Question - 13
c
30
4165
40
4166
Question - 14
c
Shrishti writes the code for a function that computes the factorial
of the inputted number n.â¨function factorial(n)â¨{
if(n equals 1) return 1
else
-- MISSING STATEMENT -- end
}
Fill in the missing statement.
return factorial(n-1)
return n*factorial(n)
return n*(n-1)
return n*factorial(n-1)
Question - 15
c
Consider the following code: function modify(a,b)
{
integer c, d = 2
c = a*d + b
return c
}
function calculate( ) {
integer a = 5, b = 20, c integer d = 10
c = modify(a, b); c=c+d
print c
}
Assume that a and b were passed by value. What will be the
output of the function calculate( ) ?
80
40
32
72
Question - 16
c++
short
int
char
float
Question - 17
c++
include <iostream>
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main ()
{
int a;
a = first::var + second::var;
cout << a;
return 0;
}
8.31416
8
compile time
error
Question - 18
c++
both a & b
None of the
mentioned
Question - 19
c++
#include<stdio.h>
union student
{
int y[34];//Consider int as 2 byte
char var2[7];//Consider char as 1 byte
char arr[8];
char ch[5];
};
int main()
{
union student st;
printf("%d", sizeof(union student));
return 0;
}
126
136
146
142
Question - 20
c++
#include <iostream>
using namespace std;
int main()
{
enum channel {star, sony, zee};
enum symbol {hash, star};
int i = 0;
for (i = star; i <= zee; i++) {
printf("%d ", i);
}
return 0;
}
12
123
Error
012
Question - 21
Merge them
For example:
A -> 1,2,3
B -> 4,5,6
Then, C -> 1,2,3,4,5,6
Input:
NM
Space separated N elements of A
Space separated M elements of B
Output:
Space separated N+M elements of C
Example:
Input:
45
1245
36789
Output:
123456789
Question - 22
Zero sum
Find the two elements from the given array A of size N such that
their sum is closest to zero.
For example,
A -> 1,2,-1,5
Then the two elements whose sum is closest to zero are 1,-1
Input Format:
First line contains N (size of the array A)
Second line contains N elements of array A
Output Format:
Space separated elements
Example:
Input:
4
1 2 -1 5
Output:
1 -1
Question - 23
Next Greater
Input:
First line contains N, size of the array A
Space separated N elements of A
Output
Space separated processed array
Example:
Input:
6
16 17 4 3 5 2
Output:
17 5 5 5 2 -1