Code Carnival

Code Carnival

University

25 Qs

quiz-placeholder

Similar activities

EST102 : PROGRAMMING IN C TEST 1

EST102 : PROGRAMMING IN C TEST 1

University

20 Qs

TECHFEST QUALIFYING ROUND

TECHFEST QUALIFYING ROUND

University

20 Qs

PSC Quiz1

PSC Quiz1

University - Professional Development

20 Qs

Linux 3-4

Linux 3-4

University

20 Qs

Operators in C

Operators in C

University

24 Qs

Java Programming

Java Programming

University

20 Qs

Apuntadores en C

Apuntadores en C

University

20 Qs

Programming in C(1)

Programming in C(1)

University

20 Qs

Code Carnival

Code Carnival

Assessment

Quiz

Computers

University

Medium

Created by

Kabhilan VS

Used 1+ times

FREE Resource

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?


#include<stdio.h>

int main() {

    int x = 3;

    if (x == 3 || x == 2 * 2 && x != 5) {

        printf("Hello\n");

    } else { printf("World\n");

    }

    return 0;

}

Hello
World
Compilation Error
Hello World

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many times will the loop execute? 


#include<stdio.h>

int main() {

    int i;

    for (i = 1; i <= 6; i++) {

        if (i % 2 == 0) {

            printf("%d ", i++);

        }

    }

   return 0;

}

2 4
2 3 6
2 4 6
Infinite loop

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?


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

printf("%d", arr[3]); 

0
3
Garbage value
Compilation error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the following declaration in C:

int arr[5];

float arr2[3];

Which of the following statements correctly calculates the total number of bytes required to store these arrays, considering the typical memory sizes for int and float (assuming int is 4 bytes and float is 4 bytes on your system)?

sizeof(arr) + sizeof(arr2)
sizeof(arr) * sizeof(arr2)
sizeof(arr) + sizeof(arr2)) / 2
(sizeof(arr) + sizeof(arr2)) - sizeof(int)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?


#include <stdio.h> 

int main() { 

    char str[5] = "Hello"; 

    printf("%s", str); 

    return 0; 

}

Hello
Compilation error
Undefined behavior
H

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output?  

int x = 10;  
switch (x) {  
    case 5: printf("Five");  
    case 10: printf("Ten");  
    case 15: printf("Fifteen");  
}  

Five
Ten
TenFifteen
Compilation error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function is used to find the length of a string?

strlen()
sizeof()
strlength()
length()

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?