What will be the output of the following C code?
#include<stdio.h>
main()
{
int n;
n=f1(4);
printf("%d", n);
}
f1(int x)
{
int b;
if(x==1)
{
return 1;
}
else
{
b=x*f1(x-1);
return b;
}
}
Programming and Technical - L3
Quiz
•
Education
•
University
•
Hard
CSE CodeClub
Used 4+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What will be the output of the following C code?
#include<stdio.h>
main()
{
int n;
n=f1(4);
printf("%d", n);
}
f1(int x)
{
int b;
if(x==1)
{
return 1;
}
else
{
b=x*f1(x-1);
return b;
}
}
24
4
12
10
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What will be the output of the following C code?
#include<stdio.h>
void main()
{
int a[5] = {5,1,15,20,25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
}
2, 3, 20
3, 2, 15
2, 1, 15
1, 2, 5
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
What will be the output of the following code snippet?
#include <stdio.h>
void solve() {
int a = 3;
int res = a++ + ++a + a++ + ++a;
printf("%d", res);
}
int main() {
solve();
return 0;
}
12
24
20
18
4.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
void main()
{
int sum=1, index=9;
do
{
index = index - 1;
sum *= 2;
}while( index > 9);
}
1
2
9
0.5
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
#include<stdio.h>
void main()
{
int i,j;
for(i=0,j=0;i<10,j<20;i++,j++)
{
printf("i=%d %t j=%d", i,j);
}
}
10 10
10 20
20 20
Error
6 questions
PR EidP Quiz Seminar 3
Quiz
•
University
10 questions
DS Lab IT-B-Quiz-1
Quiz
•
University
10 questions
Pop Quiz #2 Topic 2
Quiz
•
University
10 questions
202401 BGMC4513 Quiz 1
Quiz
•
University
10 questions
LAW OF CONTRACT
Quiz
•
University
10 questions
Translasi
Quiz
•
University
10 questions
Python
Quiz
•
1st Grade - Professio...
10 questions
C program
Quiz
•
University
10 questions
Chains by Laurie Halse Anderson Chapters 1-3 Quiz
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
12 questions
Multiplying Fractions
Quiz
•
6th Grade
30 questions
Biology Regents Review #1
Quiz
•
9th Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
50 questions
Biology Regents Review: Structure & Function
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University
16 questions
Chapter 8 - Getting Along with your Supervisor
Quiz
•
3rd Grade - Professio...
6 questions
Railroad Operations and Classifications Quiz
Quiz
•
University
71 questions
Logos
Quiz
•
3rd Grade - University
8 questions
Mali - Geography
Quiz
•
University