
Play with C
Authored by Computer India
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
1. function g(int n)
{
If(n>0) return 1;
else return -1;
}
function f( int a, int b)
{
If(a>b) return g(b-a);
If(a<b) return g(a-b);
return 0;
}
If f(a,b) is called , what is returned ?
a)Always -1
b)1 if a>b, -1 if a<b, 0 otherwise
c)-1 if a>b, 1 if a<b, 0 otherwise
d)0 if a equals b, -1 otherwise
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
2. Assuming n > 2. What value does the following function compute for even n ?
int f(int n)
{
If( n equals 1) { return 1}
If(n equals 2) { return f(n-1) + n/2 }
return f(n-2) + n
}
a)1 +2 + 3 + 4 + …. +n
b)1 + (2+4+ 6+ 8+ …. +n)
c)1 + n/2 + (4 +6 + 8 + …. + n)
d)2 + 4 + 6 + 8 + ……. + n
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
3. What is the output of the following code?
int main()
{
int i = 0;
switch(i)
{
case 0 : i++;
case 1 : i+++2;
case 2 : ++i;
}
printf("%d",i++);
return 0;
}
a) 2
b) 3
c) 4
d) 5
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
4. What is the output of this program?
int main()
{
int a = 1, b = 0;
int c = a%2 ? a++ : a-- ? a=0 : ++b ? b = 2 : b++ ;
printf("%d", c);
return 0;
}
a) 1
b) 2
c) 3
d) 0
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
5. How can you write a[i][j][k][l] in equivalent pointer expression?
a) (((***(a+i)+j)+k)+l)
b) ((**(*(a+i)+j)+k)+l)
c) (*(*(*(a+i)+j)+k)+l)
d) *(*(*(*(a+i)+j)+k)+l)
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
6. What is the output of this program?
#include <stdio.h>
void test(char**);
int main()
{
char *argv[] = {"A", "B", "C", "D"};
test(argv);
return 0;
}
void test(char **p)
{
char *m;
m = (p+= sizeof(int))[-2];
printf("%s", m);
}
a) A
b) B
c) C
d) D
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
7. What will be the output of the program?
#include <stdio.h>
int main(void)
{
char p;
char buf[10]={1,2,3,4,5,6,9,8};
p=(buf+1)[5];
printf("%d",p);
return 0;
}
a. 5
b. 6
c. 9
d. None of the above
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
26 questions
pensamiento computacional1
Quiz
•
University
25 questions
CSS
Quiz
•
9th Grade - University
25 questions
Komputer Dasar
Quiz
•
University
25 questions
Internet
Quiz
•
University
25 questions
Quize SK
Quiz
•
12th Grade - University
25 questions
Review Ruting Dinamik
Quiz
•
University
25 questions
MIND IT 2025 QUIZZY BRANIACS ROUND 1
Quiz
•
University
25 questions
Повторение файлы и устройства ПК 7 класс
Quiz
•
7th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade