C Language

C Language

University

10 Qs

quiz-placeholder

Similar activities

TECH INTELLECT - ROUND 2

TECH INTELLECT - ROUND 2

University

10 Qs

Milking Minds 2 17-01-24

Milking Minds 2 17-01-24

University

15 Qs

C Programming - Basics 001

C Programming - Basics 001

University

10 Qs

C Programming Quiz-1

C Programming Quiz-1

University

10 Qs

Recursion

Recursion

University

8 Qs

c-languiz

c-languiz

University

10 Qs

DSA quiz 3 set 1

DSA quiz 3 set 1

University

10 Qs

C programming

C programming

University

15 Qs

C Language

C Language

Assessment

Quiz

Computers

University

Hard

Created by

Sahitya Satya

Used 14+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

#include <stdio.h>  

void change(int,int);  

int main()  

{  

    int a=15,b=16;  

    change(a,b); 

    printf("Value of a is: %d",a);  

    printf("\n");  

    printf("Value of b is: %d",b);  

    return 0;  

}  

void change(int x,int y)  

{  

    x=13;  

    y=17;  

What will be the output:-

Value of a is: 15 Value of b is: 16

Value of a is: 13 Value of b is: 17

Value of a is: 16 Value of b is: 15

Value of a is: 17 Value of b is: 13

2.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

Correct way to initialize an array in C programming Language is:-

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

int num[6] = { 1, 2, 3, 16, 25, 45, 9 };

int a={};

int x{3}={2,3,4};

3.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

The correct output of given code snippet is:-

#include<stdio.h>

void main()

{

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

int i, j, k;

i= ++a[1];

j= a[1]++;

k= a[1++];

printf("%d, %d, %d", i, j, k);

}

3, 4, 1

2, 2, 9

4, 3, 4

3, 3, 1

4.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

The correct Code to swap two numbers in C language without using a third variable is:-

#include<stdio.h>

int main()

{

int a=10, b=20;

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

a=a-b;

b=a-b;

a=a+b;

printf("\nAfter swap a=%d b=%d",a,b);

}

#include<stdio.h>

int main()

{

int a=10, b=20;

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

a=a+b;

b=a+b;

a=a-b;

printf("\nAfter swap a=%d b=%d",a,b);

}

#include<stdio.h>

int main()

{

int a=10, b=20;

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

a=a+b;

b=a-b;

a=a+b;

printf("\nAfter swap a=%d b=%d",a,b);

}

#include<stdio.h>

int main()

{

int a=10, b=20;

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

a=a+b;

b=a-b;

a=a-b;

printf("\nAfter swap a=%d b=%d",a,b);

}

5.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

The correct output of given code snippet is:-

#include<stdio.h>

int main()

{

int x=5;

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

return 0;

}

0

5

10

1

Answer explanation

The bitwise left shift operator(<<) shifts all bits towards the left by a certain number of specified bits. The expression x<<1 always returns x*2

6.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

Which code snippet will be executed faster:-

a) #include<stdio.h>

int main()

{

int x=5;

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

return 0;

}

b)#include<stdio.h>

int main()

{

int x=5;

printf("%d", x+=1); // same as x=x+1

return 0;

}

Only b

Only a

Both will take same time

It depends on compiler

Answer explanation

x++ being a unary operation, it just needs one variable. Whereas, x = x + 1 is a binary operation that adds overhead to take more time.

7.

MULTIPLE CHOICE QUESTION

1 min • 10 pts

During function call, Default Parameter Passing Mechanism is called as

Call by Reference

Call by Address

Call by Name

Call by Value

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?