wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Sec-I-cquiz1

Total questions: 77

Worksheet time: 37mins

Name
Class
Date
1.

Which header file is required to perform standard input and output opeartions

a)

math.h

b)

stdio.h

c)

input.h

d)

io.h

2.

Which of the following is correct identifier?

a)

int

b)

1ab

c)

a_123

d)

a 123

3.

what is the output of the following statement?

printf("hi\nhello\nhow\bare\ryou");

a)

hi

hello

how

are

you

b)

hi

hello

hoare

you

c)

hi

hello

youre

d)

hi

hello

youare

4.

Who is the father of C language?

a)

Dennis Ritche

b)

Charles Babbage

c)

Steve Jobs

d)

V Kohli

5.

Which of the following is not a valid C variable name?

a)

int num;

b)

float price;

c)

char a_s;

d)

int $total;

6.

The C-preprocessors are specified with _________ symbol.

a)

$

b)

#

c)

&

d)

*

7.

What is the sizeof(char) in a 32-bit C compiler?

a)

1 bit

b)

2 bits

c)

1 byte

d)

2 bytes

8.

What will be the final value of x in the following C code?

#include <stdio.h>

void main()

{

int x = 5 * 9 / 3 + 9;

}

a)

3.75

b)

24

c)

3

d)

15

9.

What will be the output of the following C code snippet?

#include <stdio.h>

void main()

{

1 < 2 ? printf("Hi"): printf("hello");

}

a)

Hi

b)

hello

c)

hi

hello

d)

none

10.

What is the size of an int data type in 64-bit compiler?

a)

4 bytes

b)

8 bytes

c)

10 bytes

d)

2 bytes

11.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int y = 3;

int x = 5 % 2 * 3 / 2;

printf("Value of x is %d", x);

}

a)

Value of x is 1

b)

Value of x is 3

c)

Value of x is 1.5

d)

Error

12.

What is the precedence of arithmetic operators (from highest to lowest)?

a)

%, *, /, +, –

b)

%, +, /, *, –

c)

+, -, %, *, /

d)

%, +, -, *, /

13.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int a = 10;

double b = 5.6;

int c;

c = a + b;

printf("%d", c);

}

a)

15.6

b)

15

c)

16

d)

10

14.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int a = 10, b = 5, c = 5;

int d;

d = a == (b + c);

printf("%d", d);

}

a)

Error

b)

1

c)

10

d)

15

15.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int x = 1, y = 0, z = 5;

int a = (x && y) || (z++);

printf("%d", z);

}

a)

error

b)

5

c)

6

d)

0

16.

Which among the following is NOT a logical opearator?

a)

&&

b)

||

c)

!

d)

!=

17.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int x = 1, z = 3;

int y = x << 3;

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

}

a)

error

b)

1

c)

8

d)

-1

18.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int h = 8;

int b = h++;

printf("%d%d\n", b, h);

}

a)

8 8

b)

8 9

c)

9 9

d)

9 8

19.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

char b = 'B';

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

}

a)

65

b)

66

c)

B

d)

b

20.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

char b = 'B';

printf("%c\n", b+32);

}

a)

65

b)

66

c)

B

d)

b

21.

The ______ symbol denotes decision making in flowchart?

a)

b)

c)

d)

22.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

char b = 'B';

printf("%c\n", b+3);

}

a)

E

b)

e

c)

B

d)

b

23.

The ______ symbol used for input/ output operation in flowchart?

a)
b)
c)
d)
24.

What is the output of this program?

#include <stdio.h>

void main()

{

printf("hello\rworld\n");

printf("hello\b\b\bworld\n");

}

a)

hello

helloworld

b)

world

heworld

c)

world

hellworld

d)

helloworld

heworld

25.

What is the output of the following code?

void main()

{

int i=1;

i=2+2*i++;

printf("%d",i);

}

a)

2

b)

3

c)

4

d)

5

26.

What is the output of this program?

main ()

{

int i=5;

printf( "%d %d %d " , i, i<<2, i>>2);

}

a)

5 1 20

b)

5 20 1

c)

5 20 20

d)

5 1 1

27.

C- has ______ Keywords

a)

28

b)

32

c)

4

d)

12

28.

What compiler does?

a)

converts HL code into LL code and doesn't save

b)

converts LL code into HL code and saves

c)

converts HL code into HL code and saves

d)

converts HL code into LL code and saves

29.

1 byte =

a)

6 bits

b)

8 bits

c)

10 bits

d)

12 bits

30.

What is INTEL stands for in the company name intel?

a)

Intermediate Electronics

b)

Intelligent Electronics

c)

Integrated Electronics

d)

Industrial Electronics

31.

Conditions are developed using......

a)

Arithmetic Operators

b)

Logical Operators

c)

Comparision Operators

d)

Assignment Operator

32.

what will be output of ....


printf("%d",10+5/2);

a)

7.5

b)

7

c)

12

d)

12.5

33.

what will be output of....


printf(" %d ", 5.6 / 2.3);

a)

2.5

b)

2.2

c)

2.8

d)

0

34.

the % (modulus) can be used with _____ data type

a)

double

b)

float

c)

int

d)

char

35.

logical operators are used for......

a)

developing conditions

b)

combining conditions

c)

using conditions

d)

none of the above

36.

what will be output of following code?

int a=25;

int b=a / 10 % 10;

printf("%d",b);

a)

25

b)

5

c)

2

d)

20

37.

what wil be output of .....

a=5; b=10;

a=a+b;

b=a-b;

a=a-b;

printf("a=%d b=%d",a,b);

a)

a=5 b=10;

b)

a=10 b=10

c)

a=5 b=5

d)

a=10 b=5

38.

what will be output of....

a=5; //line 2

6=b; //line 3

printf("sum is %d",a+b); //line 4

a)

sum is 11

b)

error at line 2

c)

error at line 3

d)

error at line 4

39.

What is full form of ASCII?

a)

American Suitable Code for Information Interchange

b)

American Standard code for Interactive Information

c)

American Standard code for Information Interaction

d)

None of the above

40.

the ascii range is .....

a)

-32768 to 32767

b)

-128 to 128

c)

0-327

d)

-128 to 127

41.

what will be output of following code:


int a;

printf("%d",&a);

a)

display garbage value

b)

display address of a

c)

display 5

d)

none of the above

42.

what will be output of ....

int a=32765;

printf("%d",a+5);

a)

32770

b)

-32768

c)

-32766

d)

32766

43.

printf("%d",08);will display....

a)

8

b)

08

c)

10

d)

error

44.

if(a>b)

printf("hi");

else;

printf("hello");


if given input is 15 & 10 what will be output?

a)

hi

b)

hello

c)

hi hello

d)

ERROR

45.

if(a>b);

printf("a is big");

else

printf(" b is big");

if input is 5 & 10 what is output?

a)

5

b)

10

c)

5 10

d)

error

46.

Which is called a conditional operator in C?

a)

>

b)

==

c)

? :

d)

NONE

47.

what is main()?

a)

its a function call

b)

user defined function

c)

pre defined function

d)

library function

48.

WHT WILL BE OUTPUT OF ...


printf("%c", 'A'+7);

a)

h

b)

A

c)

H

d)

Error

49.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int ch = 2;

    switch(ch) {

        case 1: printf("1 ");

        case 2: printf("2 ");

        case 3: printf("3 ");

        default: printf("None");

    }

}

int main() {

    solve();

        return 0;

}

a)

1 2 3 None

b)

2

c)

2 3 None

d)

None

50.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int x = 1, y = 2;

    printf(x > y ? "Greater" : x == y ? "Equal" : "Lesser");

}

int main() {

    solve();

        return 0;

}

a)

Greater

b)

Lesser

c)

Equal

d)

None of the above.

51.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    printf("%d ", 9 / 2);

    printf("%f", 9.0 / 2);

}

int main() {

    solve();

        return 0;

}

a)

4 4.5000

b)

4 4.000

c)

4.5000 4.5000

d)

4 4

52.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int x = 2;

    printf("%d", (x << 1) + (x >> 1));

}

int main() {

    solve();

        return 0;

}

a)

5

b)

4

c)

2

d)

1

53.

In which of the following languages is function overloading not possible?

a)

C

b)

C++

c)

Java

d)

Python

54.

Which of the following function is used to open a file in C++?

a)

fopen

b)

fclose

c)

fseek

d)

fgets

55.

Which of the following are correct file opening modes in C?

a)

r

b)

rb

c)

w

d)

All of the above.

56.

What is the return type of the fopen() function in C?

a)

Pointer to a FILE object.

b)

Pointer to an integer.

c)

An integer.

d)

An integer.

57.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int ch = 2;

    switch(ch) {

        case 1: printf("1 ");

        case 2: printf("2 ");

        case 3: printf("3 ");

        default: printf("None");

    }

}

int main() {

    solve();

        return 0;

}

a)

1 2 3 None

b)

2

c)

2 3 None

d)

None

58.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int x = 1, y = 2;

    printf(x > y ? "Greater" : x == y ? "Equal" : "Lesser");

}

int main() {

    solve();

        return 0;

}

a)

Greater

b)

Lesser

c)

Equal

d)

None of the above.

59.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int n = 24;

    int l = 0, r = 100, ans = n;

    while(l <= r) {

        int mid = (l + r) / 2;

        if(mid * mid <= n) {

            ans = mid;

            l = mid + 1;

        }

        else {

            r = mid - 1;

        }

    }

    printf("%d", ans);

}

int main() {

    solve();

        return 0;

}

a)

5

b)

4

c)

3

d)

6

60.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    printf("%d ", 9 / 2);

    printf("%f", 9.0 / 2);

}

int main() {

    solve();

        return 0;

}

a)

4 4.5000

b)

4 4.000

c)

4.5000 4.5000

d)

4 4

61.

What will be the output of the following code snippet?

#include <stdio.h>

void solve() {

    int x = 2;

    printf("%d", (x << 1) + (x >> 1));

}

int main() {

    solve();

        return 0;

}

a)

5

b)

4

c)

2

d)

1

62.

What will be the output of the following code snippet?

#include <stdio.h>

#define VAL 5

int getInput() {

    return VAL;

}

void solve() {

    const int x = getInput();

    printf("%d", x);

}

int main() {

    solve();

        return 0;

}

a)

5

b)

Garbage Value

c)

Compilation Error

d)

0

63.

How to find the length of an array in C?

a)

sizeof(a)

b)

sizeof(a[0])

c)

sizeof(a) / sizeof(a[0])

d)

sizeof(a) * sizeof(a[0])

64.

Which of the following is not a storage class specifier in C?

a)

volatile

b)

extern

c)

typedef

d)

static

65.

What will be the output of the following code snippet?

#include <stdio.h>

void solve(int x) {

    if(x == 0) {

        printf("%d ", x);

        return;

    }

    printf("%d ", x);

    solve(x - 1);

    printf("%d ", x);

}

int main() {

    solve(3);

        return 0;

}

a)

3 2 1 0 1 2 3

b)

3 2 1 0

c)

0 1 2 3

d)

None of the above

66.

What will be the output of the following code snippet?

#include <stdio.h>

int search(int l, int r, int target, int a[]) {

    int mid = (l + r) / 2;

    if(a[mid] == target) {

        return mid;

    }

    else if(a[mid] < target) {

        return search(mid + 1, r, target, a);

    }

    else {

        return search(0, mid - 1, target, a);

    }

}

void solve() {

    int a[] = {1, 2, 3, 4, 5};

    printf("%d", search(0, 5, 3, a));

}

int main() {

    solve();

        return 0;

}

a)

2

b)

3

c)

4

d)

5

67.

What will be the output of the following code snippet?

#include <stdio.h>

int get(int n) {

    if(n <= 1) {

        return n;

    }

    return get(n - 1) + get(n - 2);

}

void solve() {

    int ans = get(6);

    printf("%d", ans);

}

int main() {

    solve();

        return 0;

}

a)

5

b)

1

c)

0

d)

8

68.

What is the output of the following code snippet?

#include <stdio.h>

#include<stdlib.h>

void set(int *to) {

    to = (int*)malloc(5 * sizeof(int));

}

void solve() {

    int *ptr;

    set(ptr);

    *ptr = 10;

    printf("%d", *ptr);

}

int main() {

    solve();

        return 0;

}

a)

10

b)

Garbage Value

c)

Cannot Say

d)

The program may crash.

69.

Which of the following will occur if we call the free() function on a NULL pointer?

a)

Compilation Error.

b)

Runtime Error.

c)

Undefined Behaviour.

d)

The program will execute normally.

70.

Which of the following should be used to free memory from a pointer allocated using the “new” operator?

a)

free()

b)

delete

c)

realloc()

d)

None of the above.

71.

Which data structure is used to handle recursion in C?

a)

Stack.

b)

Queue.

c)

Deque.

d)

Trees.

72.

What will be the output of the following code snippet?

#include <stdio.h>

#define CUBE(x) x x x

void solve() {

    int ans = 216 / CUBE(3);

    printf("%d", ans);

}

int main() {

    solve();

        return 0;

}

a)

8

b)

648

c)

72

d)

None of the above.

73.

What will be the output of the following code snippet?

#include <stdio.h>

struct School {

    int age, rollNo;

};

void solve() {

    struct School sc;

    sc.age = 19;

    sc.rollNo = 82;

    printf("%d %d", sc.age, sc.rollNo);

}

int main() {

    solve();

        return 0;

}

a)

19 82

b)

Compilation Error

c)

82 19

d)

None of the above.

74.

Which of the following is not true about structs in C?

a)

No Data Hiding.

b)

Functions are allowed inside structs.

c)

Constructors are not allowed inside structs.

d)

Cannot have static members in the struct body.

75.

What will be the output of the following code snippet?

#include <stdio.h>

struct School {

    int age, rollNo;

};

void solve() {

    struct School sc;

    sc.age = 19;

    sc.rollNo = 82;

    printf("%d", (int)sizeof(sc));

}

int main() {

    solve();

        return 0;

}

a)

1

b)

4

c)

8

d)

16

76.

What will be the output of the following code snippet?

#include <stdio.h>

union School {

    int age, rollNo;

    double marks;

};

void solve() {

    union School sc;

    sc.age = 19;

    sc.rollNo = 82;

    sc.marks = 19.04;

    printf("%d", (int)sizeof(sc));

}

int main() {

    solve();

        return 0;

}

a)

4

b)

8

c)

16

d)

12

77.

What will be the output of the following code snippet?

#include <stdio.h>

#include<string.h>

void solve() {

    char s[] = "Hello";

    printf("%s ", s);

    char t[40];

    strcpy(t, s);

    printf("%s", t);

}

int main() {

    solve();

        return 0;

}

a)

Hello Hello

b)

Hello

c)

Compilation Error

d)

None of the above.