Programming
Description: Test your C skill in programming language for campus placements for bca, mca, b.sc IT, M.Sc. IT by free online preparation and practice paper tests | |
Number of Questions: 23 | |
Created by: Vaibhav Pathak | |
Tags: Basics C Skills Advanced C Skills C Skills Test Java Skill Test DBMS Oracle PHP Computer Application Placement Papers MCA Entrance BCA BSC Programming Fundamentals of Computer Programming Letter E Antonyms Synonyms LCM/HCF |
char *ptr;
char myString[] = abcdefg;
ptr = myString;
ptr += 5;
What string does ptr point to in the sample code above?
int x = 3;
if( x == 2 )
x = 0;
if( x == 3 )
x++;
else x += 2;
What value will x contain when the above sample code is executed?
Which of the following will declare a pointer to an integer at address 0x200 in memory?
x = 3, counter = 0; while ((x-1)) { ++counter; x--; } Referring to the sample code above, what will be the value of variable counter after the execution of the code?
char ** array [12][12][12]; Consider array, defined above. Which of the following definitions and initializations of p is valid?
double x = -3.5, y = 3.5;
printf( "%.0f : %.0f", ceil( x ), ceil( y ) );
printf( "%.0f : %.0f", floor( x ), floor( y ) );
What will the above code print when it is executed?
ceil =>rounds up 3.2=4 floor =>rounds down 3.2=3
int x = 5; int y = 2; char op = ''; switch (op) { default : x += 1; case '+' : x += y; /*It will go to all the cases/ case '-' : x -= y; } After the sample code above is executed, what will be the value of variable x?
Which of the following functions returns the string representation from a pointer to a time t value?
short testarray[4][3] = { {1}, {2, 3}, {4, 5, 6} }; printf(%dn, sizeof( testarray)); Assuming a short is two bytes long, what will be printed by the above code?
struct customer *ptr = malloc( sizeof( struct customer ) ); Given the sample allocation for the pointer ptr found above, which of the following statements is used to reallocate ptr to be an array of 10 elements?
Which of the following is a true statement about pointers?
void (*signal(int sig, void (*handler) (int))) (int); Which of the following definitions of sighandler_t allows the above declaration to be rewritten as follows? sighandler_t signal (int sig, sighandler_t handler);
In a C expression, how is a logical AND represented?
Which of the following Standard C functions can be used to reset end-of-file and error conditions on an open stream?
char buf [] = Hello world!; char * buf = Hello world!; In terms of code generation, how do the two definitions of buf, both presented above, differ?
Which of the following will read a character from the keyboard and store it in the variable c?
How do printf()'s format specifiers %e and %f differ in their treatment of floating-point numbers?
Which of the following C operators is right associative?
char ptr1[] = "Hello World"; char *ptr2 = malloc( 5 ); ptr2 = ptr1; What is wrong with the above code (assuming the call to malloc does not fail)?
What does the auto specifier do?
#include <stdio.h>
int i;
void increment( int i )
{
i++;
}
int main()
{
for( i = 0; i < 10; increment( i ) )
{
}
printf(i=%dn, i);
return 0;
}
What will happen when the program above is compiled and executed?
How do you include a system header file called sysheader.h in a C source file?
Which one of the following printf() format specifiers indicates to print a double value in decimal notation, left aligned in a 30-character field, to four (4) digits of precision?