Top 100 Important MCQ's With Answer From C Programming BCAC-101
Top 100 Important MCQ's With Answer From C Programming BCAC-101
1 . The Founder of C Programing language is?
a) Danis Ritchie
b) Mark Zuckerberg
c) Charls Babej
d) Bill Gates Click To See Answer
Ans: a) Danis Ritchie
Click To See Answer
Ans: a) Danis Ritchie2. 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 of any length
5. Which is valid C expression?
a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;
6. Which of the following cannot be a variable name in C?
a) volatile
b) true
c) friend
d) export
7. What is short int in C programming?
a) The basic data type of C
b) Qualifier
c) Short is the qualifier and int is the basic
data type
d) All of the mentioned
8. Which of the following declaration is not supported by C language?
a) String str;
b) char *str;
c) float str = 3e2;
d) Both String str; & float str = 3e2;
9. Which keyword is used to prevent any changes in the variable within a C
program?
a) immutable
b) mutable
c) const
d) volatile
10. What is the result of logical or relational expression in C?
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive
number if an expression is true
d) None of the mentioned
1.Who is father of C Language?
A. jarne Stroustrup
B. James Gosling
C. Dennis Ritchie
D. Dr. E.F. Codd
2. C language developed at _____?
A. AT & T's Bell Laboratories of USA in 1972
B. AT & T's Bell Laboratories of USA in 1970
C. Sun Microsystems in 1973
D. Cambridge University in 1972
3. For 16-bit compiler allowable range for integer constants is ____?
A.-3.4e38 to 3.4e38
B.-32767 to 32768
C.-32668 to 32667
D.-32768 to 32767
4. C programs are converted into machine language with the help of
A. An Editor
B. A compiler
C. An operating system
D. None of these.
5. C was primarily developed as
A. System programming language
B. General purpose language
C. Data processing language
D. None of the above.
6. Standard ANSI C recognizes __ number of keywords?
A. 30 B.
32
C. 24 D.
36
7. A C variable cannot start with
A. A number
B. A special symbol other than underscore
C. Both of the above
D. An alphabet
8. Low level language is .?
a) Human readable like language.
b) language with big program size.
c) language with small program size.
d) Difficult to understand and readability is
questionable.
9. High level language is a .?
a) Human readable like language.
b) language with big program size.
c) language with small program size.
d) language which is difficult to understand and
not human readable.
10. C is ___ type of programming language.?
a) Object Oriented b) Procedural
c) Bit level language d) Functional
1) What is the 16-bit compiler allowable range for integer constants?
A) -3.4e38 to 3.4e38 B) -32767 to 32768
C) -32768 to 32767 D)
-32668 to 32667
2. What will be the output of this program?
main()
{printf("javatpoint");
main();}
- Wrong statement B.
It will keep on printing javatpoint
- It will Print
javatpoint once D.
None of the these
3. What is required in each C program?
A.
The program must have at least one function
B.
The program does not require any function
C.
Input data D. Output data
4.Which of the following comment is correct when a macro definition
includes arguments?
- The opening parenthesis should immediately follow the macro name.
- There should be
at least one blank between the macro name and the opening parenthesis.
- There should be
only one blank between the macro name and the opening parenthesis.
- All the above
comments are correct
5. What is a lint?
A.
C compiler B. Interactive debugger.
C. Analyzing
tool D. C interpreter
6. What is the output of this statement "printf("%d",
(a++))"?
A. The
value of (a + 1)
B.
The current value of a
C.
Error message
D.
Garbage
E.
7. Why is a macro used in place of a function?
- It reduces
execution time.
- It reduces code
size.
- It increases
execution time.
- It increases code size.
8. In the C language, the constant is defined ___.
- Before main
- After main
- Anywhere, but starting on a new line.
- None of the
these.
9.Which one of the following is a loop construct that will always be
executed once?
- For B. while
C. switch D. do
while
10.Which of the following best describes the ordering of destructor calls
for stack-resident objects in a routine?
- The first object
created is the first object destroyed; last created is last destroyed.
- The first object destroyed is the last object destroyed; last created
is first destroyed.
- Objects are
destroyed in the order they appear in memory, the object with the lowest memory
address is destroyed first.
- The order is
undefined and may vary from compiler to compiler.
11. Which of the following
special symbol allowed in a variable name?
A.* (asterisk) B.|
(pipeline)
C.- (hyphen) D.
_ (underscore)
2. How would you round off a
value from 1.66 to 2.0?
A.ceil(1.66)
B.floor(1.66)
C.roundup(1.66)
D.roundto(1.66)
3. By default a real number
is treated as a
A. float
B. double
C. long double
D. far double
4. When we mention the
prototype of a function?
A. Defining
B. Declaring
C. Prototyping
D. Calling
5. Which of the following
correctly shows the hierarchy of arithmetic operations in C?
A. / + * - B. * - / +
C. + - / * D. / * + -
6. Can you combine the
following two statements into one?
char p; p = (char)
malloc(100);
A. char p = *malloc(100);
B. char *p = (char) malloc(100);
C. char p = (char)malloc(100);
D. char p = (char *)(malloc)(100);
7. In which header file is
the NULL macro defined?
A.stdio.h
B.stddef.h
C.stdio.h and stddef.h
D.math.h
8. If a variable is a
pointer to a structure, then which of the following operator is used to access
data members of the structure through the pointer variable?
A.. B.&
C.* D.->
9. A pointer is
A.A keyword used to create
variables
B.A variable that stores
address of an instruction
C.A variable that stores
address of other variable
D.All of the above
10. The operator used to get
value at address stored in a pointer variable is
A.* B.&
C.&& D.||
11. The keyword used to
transfer control from a function back to the calling function is
A.switch B.goto
C.go back D.return
12. Which of the following
function sets first n characters of a string to a given character?
A.strinit() B.strnset()
C.strset() D.strcset()
13. If the two strings are
identical, then strcmp() function returns
A.-1 B.1
C.0 D.Yes
14. The library function
used to find the last occurrence of a character in a string is
A.strnstr() B.laststr()
C.strrchr() D.strstr()
15. Which of the following
function is used to find the first occurrence of a given string in another
string?
A.strchr() B.strrchr()
C.strstr() D.strnset()
16. Which of the following
function is more appropriate for reading in a multi-word string?
A.printf(); B.scanf();
C.gets(); D.puts();
17. What is the purpose
of "rb" in fopen() function used below in the
code?
FILE *fp; fp =
fopen("source.txt", "rb");
A.open
"source.txt" in binary mode for reading
B.open
"source.txt" in binary mode for reading and writing
C.Create a new file
"source.txt" for reading and writing
D.None of above
18. What
does fp point to in the program ?
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("trial",
"r");
return 0;
}
A.The first character in the
file
B.A structure which contains
a char pointer which points to the first character of a file.
C.The name of the file. D.The last
character in the file.
19. Which of the following
operations can be performed on the file "NOTES.TXT" using the below
code?
FILE *fp; fp =
fopen("NOTES.TXT", "r+");
A. Reading B. Writing
C. Appending D. Read and Write
20. Out
of fgets() and gets() which function is safe to use
A. gets()
B. fgets()
Answer
1=d
1. While calling
the fprintf() function in the format string conversion
specifier %s can be used to write a character string in capital
letters.
A.True
B.False
2. A text stream is an
ordered sequence of characters composed into lines, each line consisting of
zero or more characters plus a terminating new-line character.
A.True
B.False
3. Offset used
in fseek() function call can be a negative number.
A.True
B.False
4. We should not read after
a write to a file without an intervening call to fflush(), fseek() or rewind()
A. True
B. False
5. In a call
to printf() function the format specifier %b can be used to print
binary equivalent of an integer.
A.True
B.False
6. stderr, stdin,
stdout are FILE pointers
A.Yes
B.No
7. A file written in text
mode can be read back in binary mode.
A.Yes
B.No
8. Can we specify a variable
filed with in a scanf() format string?
A.Yes
B.No
9. Which of the following
statement is correct about the program?
#include<stdio.h>
int main()
{
FILE *fp;
char ch;
int i=1;
fp =
fopen("myfile.c", "r");
while((ch=getc(fp))!=EOF)
{
if(ch == '\n')
i++;
}
printf("%d",i);
fclose(fp);
return 0;
}
A. The code counts number of characters in the file
B. The code counts number of words in the file
C. The code counts number of blank lines in the file
D. The code counts number of lines in the file
10. Which of the following
statement is correct about the program?
#include<stdio.h>
int main()
{
FILE *fp;
char str[11], ch;
int i=0;
fp =
fopen("INPUT.TXT", "r"); while((ch=getc(fp))!=EOF)
{
if(ch == '\n' || ch == ' ')
{
str[i]='\0'; strrev(str);
printf("%s", str);
i=0;
}
else
str[i++]=ch;
}
fclose(fp);
return 0;
}
A.The code writes a text to
a file
B.The code reads a text
files and display its content in reverse order
C.The code writes a text to
a file in reverse order
D.None of above
11. Point out the correct
statements about the program?
#include<stdio.h>
#include<string.h>
int main() {
FILE *fptr;
char str[80];
fptr =
fopen("f1.dat", "w");
if(fptr == NULL)
printf("Cannot open
file");
else
{
while(strlen(gets(str))>0)
{
fputs(str, fptr);
fputs("\n", fptr);
}
fclose(fptr);
}
return 0;
}
A.The code copies the
content of one file to another
B.The code writes strings
that are read from the keyboard into a file.
C.The code reads a file
D.None of above
Mock Test From Digital Electronics [Q.Set-1]
Question Text
More Mock Test Paper Will Coming Soon ! Do Follow For Update 🙏!
Comments
Post a Comment