TELANGANA UNIVERSITY
S.S.R. DEGREE COLLEGE, NIZAMABAD (C.C:5029)
II SEMESTER INTERNAL ASSESSMENT I EXAMINATIONS
PROGRAMMING WITH C & C++ QUESTION BANK
------------------------------------------------------------------------------------------------
1. Who is the father of C language? ( )
a) Steve Jobs
b) James Gosling
c) Dennis Ritchie
d) Rasmus Lerdorf
2. Which of the following is not a valid C variable name? ( )
a) int number;
b) float rate;
c) int variable_count;
d) int $main;
3. All keywords in C are in ____________ ( )
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned
4. Which of the following is true for variable names in C? ( )
a) They can contain alphanumeric characters as well as special characters
b) It is not an error to declare a variable to be one of the keywords(like goto,
static)
c) Variable names cannot start with a digit
d) Variable can be started with @ special character .
5. Which is valid C expression? ( )
a) int my,num = 1000;
b) int my_num = 1000;
c) int my num = 1000;
d) int $my_num = 1000;
6. What is an example of iteration in C? ( )
a) for
b) while
c) do-while
d) all of the mentioned
7. Which of following is not accepted in C? ( )
a) static a = 10; //static as
b) static int func (int); //parameter as static
c) static static int a; //a static variable prefixed with static
d) all of the mentioned
8. What is #include <stdio.h>? ( )
a) Preprocessor directive
b) Inclusion directive
c) File inclusion directive
d) None of the mentioned
9. The C-preprocessors are specified with _________ symbol. ( )
a) # b) $ c) ” ” d) &
10. What is the sizeof(char) in a 32-bit C compiler? ( )
a) 1 bit b) 2 bits c) 1 Byte d) 2 Bytes
11. scanf() is a predefined function in______header file. ( )
a) stdlib. h b) ctype. h c) stdio. h d) stdarg. H
12. What will be the final value of x in the following C code? ( )
1. #include <stdio.h>
2. voidmain()
3. {
4. int x =5*9/3+9;
5. }
a) 3.75 b) Depends on compiler c) 24 d) 3
13. The format identifier ‘%i’ is also used for _____ data type. ( )
a) char
b) int
c) float
d) double
14. What will be the output of the following C code considering the size of a short int
is 2, char is 1 and int is 4 bytes? ( )
1. #include <stdio.h>
2. intmain()
3. {
4. shortinti=20;
5. char c =97;
6. Float d = 1.002;
7. printf("%d, %d, %d \n",sizeof(i),sizeof(c),sizeof(d));
8. return0;
9. }
a) 2, 1, 2 b) 2, 1, 4 c) 2, 1, 6 d) 2, 1, 8
15. What will be the output of the following C code? ( )
#include<stdio.h>
#include<conio.h>
void main()
{
int i = 95;
float x = 90.99 ;
char ch = 'A' ;
i = x ;
printf("%d",i);
x = i ;
printf("%f",x);
i = ch ;
printf("%d",i);
}
a) 90.99, 95, A b) 90, 95.000000, 65 c) 7.000000, 8 d) 7, 8
16. What will be the output of the following C code snippet? ( )
1. #include <stdio.h>
2. voidmain ()
3. {int a,b;
a = 1;
b = 2;
4. a<b?return1:return2;
5. }
a) returns 1
b) returns 2
c) no value
d) all of the above
17. Comment on the following C statement. ( )
n = 1;
printf("%d, %d \n", 3*n, n++);
a) Output will be 3, 2
b) Output will be 3, 1
c) Output will be 6, 1
d) Output will be 6, 2
18. How many times i value is checked in the following C program? ( )
1. #include <stdio.h>
2. intmain()
3. {
4. inti=0;
5. while(i<3)
6. i++;
7. printf("In while loop\n");
8. }
a) 2 b) 3 c) 4 d) 1
19. What will be the output of the following C code? ( )
1. #include <stdio.h>
2. voidmain()
3. {
4. int x =5;
5. if(x <1)
6. printf("hello");
7. if(x ==5)
8. printf("hi");
9. else
10. printf("no");
11. }
a) hi b) hello c) no d) none
20. What will be the output of the following C code? ( )
1. #include <stdio.h>
2. intx;
3. voidmain()
4. {
5. if(x)
6. printf("hi");
7. else
8. printf("how are u");
9. }
a) hi b) how are you c) hi how are you d) hello
Programming with C & C++(Fill in the blanks)
1) The External variables are also called as ____________.
2) The #include <stdio.h> is a______________directive.
3) A_____________character instructs the computer to move the control to the next line.
4) C program execution begins fromsection_____________.
5) Local variable which exists and retains its value even after the control is transferred to
the calling function is_____________ storage class.
6) An _____________ storage class can be used to declare global variable known to all
the functions in theprogram.
7) The relational expression -30>=0 is _____________ (true / false).
8) The operator “++’’ is known as _____________ operator.
9) The operator “- -’’ subtracts _____________ From the operand value.
10) Consider the following statements:a=10; b=a++;
then the value of b is _____________.
11) Consider the following statement:x=100;y=200; a=(x>y)?x: y;
the value of a is _____________.
12) Consider the following statement:a=y++; y=5, then
the value of a is _______.
13) The _____________ operator can be used to determine the length of variable
according to its data type in bytes.
14) Determine the value of the following logical expression when x=10, y=15 and z=20.
Expression Result
X+y> z && z >y _____________ (true/false).
15) The standard mathematical functions are included in the_____________ header file.
16) _____________ function can be used to read a single character.
17) In C, language _____________ checks whether the input value of the argument c is
an alphabet or not.
18) An immediate exit from the loop can be achieved by a ------------ statement.
19) Which format specifier is used to print the values of double type variable _________.
20) C programs are converted into machine language with the help of _____________.
Programming with C & C++ (Short answer questions?)
1. What are basic data types supported in the C Programming Language?
2. What are tokens in C?
3. What is the difference between the local and global variables in C?
4. What is the difference between type casting and type conversion?
5. What are reserved words?
6. What is the use of printf() and scanf() functions in C Programming language?
7. What are Identifiers?
8. What are the conditional statements in c language?
9. What are the control statements in c language?
10. What are the iteration statements in c language?