
C Language

Quiz
•
Computers
•
University
•
Hard
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
Similar Resources on Wayground
15 questions
Coding club Summit Online Quiz

Quiz
•
University
9 questions
c language quiz

Quiz
•
University
15 questions
CODE ZENITH

Quiz
•
University
8 questions
Unit 2 : Operators

Quiz
•
University
10 questions
C basic

Quiz
•
University
10 questions
C- Operators

Quiz
•
University
10 questions
C - Pointers

Quiz
•
University
10 questions
Basics Of C Programming

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University