eQuiz - Multiple choice test on programming language C - part 1
TipsMake.com - Welcome to the quiz series of TipsMake.com with topics related to the fields of information technology. And this time we will continue with part 1 of the C programming knowledge test series, a total of 15 questions will be answered with no time to answer each sentence.
Question 1: What is the output of the following code?
#include main () { int x = 5 ; if ( x = 5 ) { if ( x = 5 ) break ; printf ( "TipsMake.com hello!" ); } printf ( "TipsMake.com" ); }
A - Compilation error.
B - TipsMake.com hello!
C - TipsMake.com
D - Compiler warning.
Question 2: What is the size of the union definition below?
#include union abc { char a , b , c , d , e , f , g , h ; int i ; } abc ; main () { printf ( "% d" , sizeof ( abc )); }
A - 1
B - 2
C - 4
D - 8
Question 3: Please indicate the option to attach a file to the current program is invalid below:
A - #include
B - #include 'file'
C - #include
D - All của số này không hợp lệ.
Question 4: What is the output of the following program?
A - Compilation error
B - Runtime Error
C - 5
D - 10
Question 5: Are local variables in C stored in .?
A - Code segment
B - Stack segment
C - Heap segment
D - No answer right
Question 6: Where does the C rewind () library function reposition the internal cursor of the file?
A - File head.
B - End of file.
C - Between files
D - Position specified.
Question 7: The cursor formula is equivalent to using array elements a [i] [j] [k] [2] is?
A - (((a + m) + n) + o) + p)
B - * (* (* (* (a + i) + j) + k) +2)
C - * ((((a + m) + n) + o + p)
D - * (((a + m) + n + o + p)
Question 8: In the code below, P2 is:
A - Integer
B - Integer pointer
C - Both Integer and Integer pointer
D - There is no right answer
Question 9: What does the following command define?
int * ptr [10];
A - ptr is an array pointer with 10 integer pointer.
B - ptr is an array of 10 pointers to integers.
C - ptr is an array of 10 integer pointers
D - There is no right answer
Question 10: What is the output of the code below?
#include
int main ()
{
int a = 10;
if (a == a--)
printf ("TRUE 1 t");
a = 10;
if (a == --a)
printf ("TRUE 2 t");
}
A - TRUE 1
B - TRUE 2
C - TRUE 1 TRUE 2
D - No output
Question 11: Where is a valid C expression?
A - int my_num = 100,000
B - int my_num = 100000
C - int my num = 1000
D- int $ my_num = 10000
Question 12: This is the output of the following code:
#include
int main ()
{
printf ("TipsMake.com!% dn", x);
return 0;
}
A - TipsMake.com! x
B - TipsMake.com! with junk worth going after
C - Compilation error
D - TipsMake.com!
Question 13: What happens if the following code is executed?
#include
int main ()
{
int main = 3;
printf ("% d", main);
return 0;
}
A - Create compilation error
B - Generate runtime error
C - It will run without error and print 3 to the screen
D - It will create an infinite loop
Question 14: This is the output of the following code:
#include
int main ()
{
char chr;
chr = 128;
printf ("% dn", chr);
return 0;
}
A - 128
B - -128
C - Depending on the compiler
D - There is no right answer
Question 15: This is the output of the following code:
#include
int main ()
{
char * p [1] = {"TipsMake.com"};
printf ("% s", (p) [0]);
return 0;
}
A - Compilation error
B - Unknown error
C - TipsMake.com
D - No answer right
Question 16: This is the output of the following code C:
#include
int main ()
{
printf ("quantrimang.comn");
return 0;
}
A - quantrimang.com
B - quantrimang.
code
C - comquantrimang.
D - quantrimang.
Question 17: Which of the following is not a logical or relational operator?
A -! =
B - ==
C - ||
D - =
Question 18: The scope of an automatic variable is:
A - In the block it appears
B - In the block of the block it appears
C - Until the end of the program
D - Both A and B
Question 19: Is the default storage layer automatic if not specified for a local variable?
A - True
B - False
C - Depends on standards
D - Not mentioned
Question 20: What is the scope of an external variable?
A - The entire source file in which the variable is defined
B - From the declaration point to the end of the file in which the variable is defined
C - Any source file in the program
D - From the declaration point to the end of the file being compiled
Answer:
1. A 2. C 3. C 4. D 5. B 6. A 7. B 8. B 9. C 10. B 11. B 12. C 13. C 14. B 15. C 16. A 17. D 18. D 19. A 20. DGood luck!