Play with C

Play with C

University

30 Qs

quiz-placeholder

Similar activities

TARANG C-COLLEGIUM ROUND-2

TARANG C-COLLEGIUM ROUND-2

University

30 Qs

Technical Quiz

Technical Quiz

University

30 Qs

C Language Basics

C Language Basics

University

26 Qs

C Programing

C Programing

University

25 Qs

C Quiz 1

C Quiz 1

University

25 Qs

ITSA Selection Round 1

ITSA Selection Round 1

University

27 Qs

Structures and Pointers in C

Structures and Pointers in C

University

35 Qs

2nd Class Test FEB 2021

2nd Class Test FEB 2021

University

25 Qs

Play with C

Play with C

Assessment

Quiz

Computers

University

Hard

Created by

Computer India

Used 1+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?