MCQ Question Sets for C Programming (CSE101) Examination

Are you preparing for the C Programming (CSE101) examination at LPU College/University? Download our MCQ question paper for the course code CSE101 to test your knowledge and improve your chances of scoring well. Our question paper covers a range of topics related to C Programming, including software development, computer languages, and programming concepts.

CSE101 MCQ Sets. 

Download Button Given Below (60 Questions)

1. What is the output of the following code snippet?
int x = 10; 
printf("%d", x++); 
a. 10 
b. 11
c. 12 
d. None of the above

2. Which of the following is not a valid data type in C? 
a. float 
b. long double
c. unsigned int 
d. char32_t

3. What is the output of the following code snippet?
int i;
for(i=0;i<5;i++)
{
 if(i==3)
 break;
 printf("%d", i);
}
a. 0123
b. 012
c. 01234 
d. 012345

Also Read:- Previous Year Question of CSE101

4. What is the difference between a while loop and a do-while loop? 
a. The condition in a do-while loop is evaluated before each iteration, while the condition in a while loop is evaluated 
after each iteration.
b. The condition in a do-while loop is evaluated after each iteration, while the condition in a while loop is evaluated 
before each iteration. 
c. There is no difference between the two.
d. A do-while loop can only be used for iterative tasks, while a while loop can be used for any type of loop

5. Which of the following is a valid way to declare a two-dimensional array in C? 
CSE101 MCQ SETS www.GeeksforCampus.com
a. int array[3,4]; 
b. int array[3][4]; 
c. int array[][] = { {1,2}, {3,4} }; 
d. int array[][] = {1,2,3,4};

6. What is the output of the following code snippet?
int x = 10;
int y = 5;
printf("%d", x > y ? x : y);
a. 5 
b. 10 
c. Error 
d. None of the above

7. What is the purpose of the 'break' keyword in a switch statement? 
a. To exit the loop and skip to the next iteration. 
b. To exit the loop entirely. 
c. To break out of the switch statement and continue executing code after the statement. 
d. To break out of the switch statement and return a value.

8. What is the output of the following code snippet?
int a[] = {1,2,3,4,5};
printf("%d", *(a+2));
a. 1 
b. 2 
c. 3 
d. 4

9. Which of the following is not a valid operator in C?
a. += 
b. ++ 
c. –
d. ><

10. What is the output of the following code snippet?
int x = 5;
int *p = &x;
CSE101 MCQ SETS www.GeeksforCampus.com
printf("%d", ++(*p));
a. 5 
b. 6 
c. Error 
d. None of the above

Answers:
1. a
2. d
3. b
4. b
5. b
6. b
7. b
8. c
9. d
10. b

Also Read:- Previous Year Question of CSE101

31. Computer programmers often refer to memory addresses using ____notation, or base 16.

a. binary

b. indirect

c. mathematical

d. hexadecimal

Ans: d. It's a number system based on 16

 

32. After a programmer plans the logic of a program, she will next ____.

a. understand the problem

b. test the program

c. translate the program

d. code the program

Ans: d. code the program

 

33. The process of walking through a program's logic on paper pictorially before you actually write the program is called ____.

a. desk-checking

b. flowcharting

c. pseudocoding

d. testing

Ans: b. A flowchart is a graphical tool to construct the logic behind the program.

 

34. What is the problem with the following statement?100=grade

a. 100 is not a reasonable grade

b. 100 should be in quotes

c. data types don't match

d. value on the left must be a variable name

Ans: d. Most programming languages do not allow a non-variable to sit on the lefthand of an assignment statement.

 

35.What symbol is used to represent output in a flowchart?

a. square

b. circle

c. parallelogram

d. triangle

Ans: c. Both Input/Output are represented as a parallelogram. Examples: Get X fromthe user; display X.

 

36. What is the standard terminal symbol for a flowchart?

a. circle

b. lozenge

c. diamond

d. square

Ans: b. Start and end symbols, represented as lozenges, ovals or rounded rectangles, usually containing the word "Start" or "End".

 

37. C Programming was created at_____________ by Dennis Ritchie.

a. Stanford lab

b. Haward University

c. AT & T Bell Laboratory

d. LPU university

Ans: c

 

38. C Programming was created in Year.

a 1980

b 1990

c 1972

d1982

Ans: c

 

39. #include is called

a. Preprocessor directive

b. Inclusion directive

c. File inclusion directive

d. None of the mentioned

Ans. A

 

40. C preprocessors can have compiler specific features.

A. true

B. false

C. Depends on the standard

D. Depends on the platform

Ans. A

 

41. Preprocessor feature that supply line numbers and file names to compiler is called?

A. Selective inclusion

B. macro substitution

C. Concatenation

D. Line control

Ans. D

 

42. A preprocessor is a program.

A. That processes its input data to produce output that is used as input to another program

B. That is nothing but a loader

C. That links various source files

D. All of the mentioned

Ans. A

 

43. #include statement must be written.

A. Before main()

B. Before any scanf/printf

C. After main()

D. It can be written anywhere

Ans. B

 

44. The C-preprocessors are specified with _________symbol.

A.#

B.$

C." "

D. None of the mentioned.

Ans. A

 

45. The preprocessor provides the ability for _______________.

A. The inclusion of header files

B. The inclusion of macro expansions

C. Conditional compilation and line control.

D. All of the mentioned

Ans. D The preprocessor provides the ability for the inclusion of header files, macroexpansions, conditional compilation, and line control.

 

//The C character set, Identifiers and keywords, Data Types, Constants andvariables, Expressions

46. Given the following code, what is printed?

int r;r = 14;

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

a.13 14

b.15 14

c.14 14

d.14 15

ANSWER: C

 

47. Which of the following expressions is not a unary expression?

a. x

b. -x

c. sizeof(x)

d. +x

ANSWER: A

 

48. Which of the following is not a valid assignment expression?

a. a = b = 0

b. a *= b

c. a = b + 1

d. a + b = c

ANSWER: D

49. Given x is 3, y is 4, and z is 5, what is the value of the expression--x * (3 + y) / 2 - z++ * y?

a. -9

b. 8

c. -10

d.-13

ANSWER: d

 

50. The following code contains an error. What is it?

float value;

scanf(“%f”, value);

a. The format specifier is wrong

b. The newline character is missing

c. The width is not specified

d. The parameter is a value and it should be an address

ANSWER: D

 

51. Which of the following input formatting statements would input the following data?

13 y 14.10

a. scanf("%d%c%f", i, c, f);

b. scanf("%i%c%f", i, c, f);

c. scanf("%d%c%f", &i, &c, &f);

d. scanf("%d %c %c", &i, &c, &f);

ANSWER:C

 

52. Which of the following statements about identifiers is false?

a. Identifiers must start with a letter or underscore

b. Identifiers may not use spaces and hyphens as part of the identifier

c. Identifiers symbolically represent data locations

d. Good programming style uses an underscore as the first character of an identifier

ANSWER: D

 

53. Which of the following is an invalid variable declaration?

a. int x_f;

b. char status;

c. double value1;

d. int emp-count;

ANSWER: D

 

54. Which of the following is an invalid initialization?

a. char c = “H”;

b. float value = 20.0;

c. int length = 4000;

d. double pi = 3.141592;

ANSWER: A

 

55. Which line have error in the following code:

L1:int main(){

L2:const int count=50;

L3:count++;

L4:printf("%d",count);

L5:getch();

L6:return 1;}

a. L1

b. L2

c: L3

d. L6

Answer: C

 

56. What would be printed on the output device if the character input is '1' :

int main(){

char c;c=getche();

printf("%c",c);

getch();

return 0;

}

a. 11

b. 1

c. 65

d. c

Answer: A

 

57. What is the output of this C code?

#include <stdio.h>

int main(){

int c = 10 ^ 9;

printf("%d\n", c);

}

a) 3

b) 8

c) 9

d) 0

Ans – a

 

58. What is the output of this C code?

#include <stdio.h>

int main(){

int a = 2;

b= a >> 1;

printf("%d\n", b);

}

a) 0

b) 1

c) 2

d) No Output.

Ans – b

 

59. Which of the following is used to exit from a loop in C?

A. continue

B. return

C. break

D. exit

Ans: C. break

 

60. Which of the following is used to allocate memory dynamically in C?

A. malloc()

B. calloc()

C. realloc()

D. All of the above

Ans: D. All of above

إرسال تعليق (0)
أحدث أقدم