0% found this document useful (0 votes)
18 views

c Programming Mc QS

Uploaded by

Naveen Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

c Programming Mc QS

Uploaded by

Naveen Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

AP ECET C Programming Mock Test-1

1. Which of the following is not a valid variable name declaration?


a) int _a3;
b) int a_3;
c) int 3_a;
d) int _3a;

2. All keywords in C are in ____________


a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned

3.What will be the output of the following C code?


#include <stdio.h>
int main()
{
printf("Hello World! %d \n", x);
return 0;
}
a) Hello World! x;
b) Hello World! followed by a junk value
c) Compile time error
d) Hello World!

4.What will happen if the following C code is executed?

#include <stdio.h>
int main()
{
int main = 3;
printf("%d", main);
return 0;
}
a) It will cause a compile-time error
b) It will cause a run-time error
c) It will run without any error and prints 3
d) It will experience infinite looping

5. Which of the following cannot be a variable name in C?


a) volatile
b) true
c) friend
d) export

6. The format identifier ‘%i’ is also used for _____ data type.
a) char
b) int
c) float
d) double

7. What will be the output of the following C code?

SAIMEDHA- Hyderabad, Tirupati, Vijayawada Page 1


AP ECET C Programming Mock Test-1

#include <stdio.h>
int main()
{
int var = 011;
printf("%d", var);
}
a) 2
b) 8
c) 9
d) 10

8. What will be the output for the given code printf(“\n The number is %07d”,1212);
a) The number is 0001212
b) The number is 1212
c) The number is 1212
d) The number is 1212000

9. The execution of any C program is


a) Sequential
b) Parallel
c) Multi-threading
d) None of these

10. Which of the following is a valid C expression?


a) Var_name=1,000;
b) Var name=1000;
c) Var_name=1000;
d) #Var_name=1000;

11. What is the output of the following C code?


#include <stdio.h>
int main()
{
int var = 011;
var=var+5;
printf("%d", var);
return 0;
}
a) 106
b) 70
c) 14
d) Compiler error

12. Which of the following statement is correct?


I. Keywords are those words whose meaning is already defined by Compiler.
II. Keywords cannot be used as variable name.
III. There are 32 keywords in C
IV. C keywords are also called as reserved words.
a) I and II
b) II and III
c) I, II and IV

SAIMEDHA- Hyderabad, Tirupati, Vijayawada Page 2


AP ECET C Programming Mock Test-1

d) All of the above

13. The output of the program is


#include<stdio.h> //line 1
int main() //line 2
{ //line 3
int x=5; y=10; z=20; //line 4
z=x+y; //line 5
printf("%d",z); //line 6
return 0; //line 7
} //line 8
a) 15
b) Error at line 4
c) 0
d) Error at line 5

14. what will be the output of the program?


#include<stdio.h>
int main()
{
printf("%d",printf("neccse"));
return 0;
}

a. compilation error
b. runtime error
c. neccse
d. neccse6

15. what will be the output of the program?

#include<stdio.h>
int main()

{
int a=5;
printf("%d"+1,a);
return 0;

a. compilation error
b. runtime error
c. 5
d. d

16. What will be the output of the C program?


#include<stdio.h>
int main()
{
int num = 8;

SAIMEDHA- Hyderabad, Tirupati, Vijayawada Page 3


AP ECET C Programming Mock Test-1

printf ("%d %d", num << 1, num >> 1);


return 0;
}
A. 7 9
B. 4 16
C. 9 7
D. 16 4
17. What will be the output of the following C code?

#include <stdio.h>
void main()
{
int x = 5.3 % 2;
printf("Value of x is %d", x);
}
a) Value of x is 2.3
b) Value of x is 1
c) Value of x is 0.3
d) Compile time error

18. Which function will you choose to join two words?


A. strcpy()
B. strcat()
C. strncon()
D. memcon()

19. What is the correct format of reading word (string) in C?


A. scanf(“%c”,&word)
B. scanf(“%s”,*word)
C. scanf(“%s”,word)
D. scanf(“%*^\n+”,&word)

20. What will be the output?


#include<stdio.h>
#include<string.h>
int main()
{
char str1[20] = "Iitkgp", str2[20] = "Nptel";
printf("%s", strcpy(str1, strcat(str2, str1)));
return 0;
}
A. IitkgpNptel
B. NptelIitkgp
C. IitkgpIitkgp
D. NptelNptel

SAIMEDHA- Hyderabad, Tirupati, Vijayawada Page 4

You might also like