0% found this document useful (0 votes)
20 views24 pages

C MCQ by Sampat Liler

The document contains multiple-choice questions (MCQs) related to C programming, specifically designed for the Rajasthan Computer Teacher Exam 2022. Each question includes options and the correct answer, covering topics such as operators, data types, control statements, and output of programs. It serves as a study guide for candidates preparing for the exam.

Uploaded by

Karan vaishnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views24 pages

C MCQ by Sampat Liler

The document contains multiple-choice questions (MCQs) related to C programming, specifically designed for the Rajasthan Computer Teacher Exam 2022. Each question includes options and the correct answer, covering topics such as operators, data types, control statements, and output of programs. It serves as a study guide for candidates preparing for the exam.

Uploaded by

Karan vaishnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

RAJASTHAN COMPUTER TEACHER EXAM 2022 ( C PROGRAMMING MCQ)

1. Operator % in C Language is called.?


A) Percentage Operator
B) Quotient Operator
C) Modulus
D) Division

Answer – C

2. Choose a right statement.


int a = 10 + 4.867;
A) a = 10
B) a = 14.867
C) a = 14
D) compiler error.

Answer – C
3. Choose a right statement.
int a = 3.5 + 4.5;
A) a = 0
B) a = 7
C) a = 8
D) a = 8.0

Answer – B
4.Choose right statement.
int main()
{
float c = 3.5 + 4.5;
printf("%f", c);

return 0;
}
A) 8.0
B) 8.000000
C) 8
D) 7

Answer – B
5. Choose a right statement.
int main()
{
float c = 3.5 + 4.5;
printf("%d", (int)c);

return 0;
}

A) 8.0
B) 8.000000
C) 7
D) 8

Answer – D
6. Choose a right statement.
int a = 5/2;
int b = 5.0/2;
int c = 5 / 2.0;
int d = 5.0/2.0;

A) a = 2, b = 2, c = 2, d= 2
B) a = 2, b = 2.0, c = 2, d= 2.0
C) a = 2, b = 2.5, c = 2.5, d= 2.5
D) a = 2.5, b = 2.5, c = 2.5, d= 2.5

Answer - A
7. What is the output of the program.?
int main()
{
int a = 25%10;
printf("%d", a);

return 0;
}

A) 2.5
B) 2
C) 5
D) Compiler error.

Answer – C
8. Which data type cannot be checked in switch-
case statement?
A.enum
B.character
C. integer
D.float

Answer – D
9. How many times "Anvira Education" is printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("Anvira Education");
}
return 0;
}
A.10 times
B.11 times
C. 0 times
D.Infinite times

Answer – C
10. How many times while loop is executed if a short
int is 2 byte wide?
#include<stdio.h>
int main()
{
int i=1;
while(i <= 155)
{
printf("%c %d\n", i, i);
i++;
}
return 0;
}
A.154 times
B.155 times
C. 156 times
D.Infinite times

Answer – B
11. Which statement is correct about the below
program?
#include<stdio.h>
int main()
{
int i = 8, j = 24;
if(i = 8) && if(j = 24)
printf("Welcome Programmer");
return 0;
}

A.Welcome Programmer
B.Error: Undeclared identifier if
C. Error: Expression syntax
D.No output

Answer – B
12. Find out the error, if any in the below program?
#include<stdio.h>
int main()
{
int j = 1;
switch(j)
{
printf("Hello programmer!");
case 1:
printf("Case1");
break;
case 2:
printf("Case2");
break;
}
return 0;
}
A.No error in program and prints "Case1"
B.Error: Invalid printf statement after switch
statement
C. Error: No default specified
D.None of the above

Answer – A

13. For printing the value of a and b given below,


which printf() statement will you use?
#include<stdio.h>
main()
float a=3.14;
double b=3.14;

A.printf("%Lf %f", a, b);


B.printf("%Lf %Lf", a, b);
C. printf("%f %Lf", a, b);
D.printf("%f %lf", a, b);

Answer – D
14. Which statements are correct about an if-else
statement in a C-program?
1. Nested if-else statements are allowed
2. Every if-else statement can be replaced by an
equivalent statement using ?: operators
3. Multiple statement in else block are allowed
4. Multiple statement in if block are allowed

A.1, 3 and 4
B.1, 2, 3 and 4
C. 2 , 3and 4
D.1 and 4

Answer – A
15. Find out the error, if any in the below program?
#include<stdio.h>
int main()
{
int P = 10;
switch(P)
{
case 10:
printf("Case 1");

case 20:
printf("Case 2");
break;

case P:
printf("Case 2");
break;
}
return 0;
}
A.Error: Constant expression required at line case
P:
B.Error: There is no break statement in each case
C. Error: No default value is specified
D.No error

Answer – A

16. Find out the error, if any in the below program?


#include<stdio.h>
int main()
{
int i = 1;
switch(i)
{
case 1:
printf("Case1");
break;
case 1*2+2:
printf("Case2");
break;
}
return 0;
}
A.Error: in switch statement
B.Error: in case 1*2+4 statement
C. Error: No default specified
D.No Error

Answer – D

17. Which of the following statements are correct


about below C-program?
#include<stdio.h>
int main()
{
int x = 100, y = 100%80, j;
for(j=1; j<10; j++)
if(x != y);
printf("x = %d y = %d\n", x, y);
return 0;
}
1. The program produce the output x=100 y=20
2. The printf() function run for 10 times
3. The semi colon(;) after the if(x!=y) will not
produce any error
4. The program will produce no output

The options are given below:


A.2
B.1,3
C. 3,4
D.4
Answer – B
18. What is the output of the given program, if a
short int is 2 bytes wide?
#include<stdio.h>
int main()
{
short int i = 0;
for(i<=5 && i>=-1; ++i; i>0)
printf("%u,", i);
return 0;
}
A.Expression syntax error
B.1 .... 65535
C. 0, 1, 2, 3, 4, 5
D.No output

Answer – B
19. What is the output of the given program?
#include<stdio.h>
int main()
{
int a=5;
do
{
printf("%d\n",a);
a= -1;
}while (a>0);
return 0;
}

A.-1
B.5
C. 0
D.Compile error

Answer – B
20. What is the built-in library function for
comparing the two strings?
A.strcmp()
B.equals()
C. str_compare()
D.string_cmp()

Answer – A

21. What will be the output of the below program ?


#include<stdio.h>
main()
{
char x[]="javaTpoint", y[]="javaTpoint";
if(x==y){
printf("Strings are Equal");
}
}
A.Strings are Equal
B.No output
C. Runtime error
D.Compilation error
Answer – A

22. What will be the output of the below program?


#include<stdio.h>
main(){
char x[] = "Hi\0Hello";
printf("%d %d", strlen(x), sizeof(x));
}
A.5 9
B.9 20
C. 2 9
D.2 5

Answer – C
23. What will be the output of the below program?
#include<stdio.h>
main(){
int x[] = {100, 200, 300};
printf("%d", *x +1);
}
A.100
B.200
C. 101
D.201

Answer – C
24. What will be the output of the below program?
#include<stdio.h>
void main()
{
char a[] = "C++";
printf("%s ",a);
a++;
printf("%s",a);
}
A.C++ ++
B.++ ++
C. C++ C++
D.Compile error

Answer – D
25. In a structure, if a variable works as a pointer
then from the given below operators which
operator is used for accessing data of the
structure using the variable pointer?
A.%
B.->
C. .
D.#
Answer – B

कं प्यूटर शिक्षक भर्ती की सम्पूर्ण र्तैयारी के शिए सम्पूर्ण कोसण और प्रैशटटस


सेट के शिशियो के शिए इस बटन पर शटिक करे -

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy