wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

A "C" Event-the backbone of modern coding.

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

What is the difference between "int" and "float" data types in C?

a)

"int" is used for integer numbers, while "float" is used for real numbers with decimal points.

b)

"int" is used for text, while "float" is used for numeric data.

c)

"int" is used for single-precision floating-point numbers, while "float" is used for double-precision floating-point numbers.

d)

There is no difference; "int" and "float" are equivalent.

2.

What is the purpose of the "break" statement in a loop in C?

a)

To exit the program

b)

To skip the next iteration of the loop

c)

To end the loop completely and continue with the next statement after the loop

d)

To jump to a specific label within the loop

3.

In C, what is the purpose of the "include" directive?

a)

To include external libraries

b)

To declare variables

c)

To define data types

d)

To comment out code

4.

Which of the following is an infinite loop in C?

a)

for (int i = 0; i < 10; i++)

b)

while (1)

c)

do { /* code / } while (0)

d)
  1. if (condition) { / code */ }


5.

What is the purpose of the "if" statement in C?

a)

To declare variables

b)

To perform conditional execution

c)

To loop through a block of code

d)

To define a new function

6.

What is the scope of a variable declared inside a function in C?

a)

Global scope

b)

Local scope

c)

Static scope

d)

Constant scope

7.

What is the return type of the "int main" function in C?

a)

void

b)

int

c)

char

d)
  1. float


8.

what is the output of above code?

a)

3 5

b)

3 3

c)

5 5

d)

5 3

9.

#include<stdio.h>

int main()

{

    static int i=5;

    if(--i){

        main();

        printf("%d ",i);

    }  

}

what is the output of above question?

a)

Error

b)

4

c)

4 3 2 1

d)

0 0 0 0

10.

# include <stdio.h>

# define scanf  "%s welcome to A "C" Event "

main()

{

   printf(scanf, scanf);

   getchar();

   return 0;

}

what is the output of above code?

a)

Missing of header file

b)

%s welcome to A "C" Event

c)

%s welcome to A "C" Event welcome to A "C" Event

d)

welcome to A "C" Event

11.

#include <stdio.h>

int main()

{

    int c = 5, no = 1000;

    do {

        no /= c;

    } while(c--);

 

    printf ("%d\n", no);

    return 0;

}

What is the output of above give code?

a)

500

b)

500

100

50

10

5

1

c)

Error

d)

infinite loop

12.

int main()

{

    int x, y = 2, z, a;

    if (x = y % 2)

        z = 2;

    a = 2;

    printf("%d %d ", z, x);

    return 0;

}

what is the output of above code?

a)

1 2

b)

0 2

c)

2 2

d)

0 0

13.

What is the purpose of the "void" keyword in a function declaration or definition?

a)

To indicate that the function does not return a value.

b)

To specify that the function is recursive

c)

To declare a function as global.

d)

To define a variable.

14.

In C, what is the purpose of the "do...while" loop?

a)

To iterate over a block of code a specific number of times.

b)

To execute a block of code at least once before checking the condition.

c)

To create an infinite loop.

d)

To iterate over a block of code with a "for" loop.

15.

What is the purpose of the "break" statement in C?

a)

To end a program

b)

To exit a loop or switch statement.

c)

To skip the next iteration of a loop

d)

To terminate a function

16.

How much enjoy learning in this work shop?

a)

Learned and enjoyed being in this workshop need more of this type.

b)

Boring need something better .

c)

Its ok to be a part of this event ,need more.

d)

enjoyed need more workshops and events.