Code Carnival

Code Carnival

University

25 Qs

quiz-placeholder

Similar activities

CORLANG Week6-7

CORLANG Week6-7

10th Grade - University

20 Qs

GA3-220501093-AA2-EV02. Cuestionario Algoritmos y DFD

GA3-220501093-AA2-EV02. Cuestionario Algoritmos y DFD

University

20 Qs

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

University - Professional Development

20 Qs

Web Technologies(A6602)

Web Technologies(A6602)

University

20 Qs

basisdata1

basisdata1

University

20 Qs

python_4_Vivek

python_4_Vivek

University

20 Qs

Teknologi Layanan Jaringan

Teknologi Layanan Jaringan

12th Grade - University

20 Qs

Algortimos e Portugol Studio

Algortimos e Portugol Studio

8th Grade - University

20 Qs

Code Carnival

Code Carnival

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Kabhilan VS

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?