Question 1 |
Consider the following ANSI C program.
#include < stdio.h >
int main()
{
int i, j, count;
count=0;
i=0;
for (j=-3; j < =3; j++)
{
if (( j > = 0) && (i++))
count = count + j;
}
count = count +i;
printf("%d", count);
return 0;
}
Which one of the following options is correct?The program will not compile successfully | |
The program will compile successfully and output 10 when executed | |
The program will compile successfully and output 8 when executed | |
The program will compile successfully and output 13 when executed |
Question 1 Explanation:
Question 2 |
What is the output of tho following program?
main(){
int x=2, y=5;
if(x < y) return (x=x+y);
else printf("z1");
printf("z2");
}
z2 | |
z1z2 | |
Compilation error | |
None of these |
Question 2 Explanation:
Question 3 |
Assume A and B are non-zero positive integers. The following code segment:
while(A!=B){
if(A > B)
A -= B;
else
B -= A;
}
cout << A; // printing the value of A
Computes the LCM of two numbers | |
Divides the larger number by the smaller number | |
Computes the GCD of two numbers | |
Finds the smaller of two numbers |
Question 3 Explanation:
Question 4 |
What will be the output of the following C code?
#include < stdio.h >
main()
{
int i;
for(i=0;i<5;i++)
{
int i=10;
printf("%d" , i);
i++;
}
return 0;
}
10 11 12 13 14 | |
10 10 10 10 10 | |
0 1 2 3 4 | |
Compilation error |
Question 4 Explanation:
Question 5 |
Consider the following segment of C-code:
int j, n;
j = 1;
while (j <= n)
j = j * 2;
The number of comparisons made in the execution of the loop for any n>0 is:\lceil \log_2n \rceil +1 | |
n | |
\lceil \log_2n \rceil | |
\lfloor \log_2n \rfloor +1 |
Question 5 Explanation:
There are 5 questions to complete.
Question number 16 of conditional statements of c programming correct option is D.
Your correct answer is b which is wrong. Please check 🙏🙏
Thank You PRAFUL SAMBHAJI RANE,
We have updated the answer.
Question number 3 is incomplete.
Thank You Rahul,
We have updated the question.