Programming (C/C++)
Description: Test your C skill in programming language for campus placements by free online preparation and practice paper tests | |
Number of Questions: 30 | |
Created by: Avani Handa | |
Tags: C Skills Test Java Skill Test DBMS Oracle PHP Computer Application Placement Papers MCA Entrance Programming Fundamentals of Computer Programming Letter JKL Synonyms Insert the Missing Character Odd One Out Classification Blood Relations Blood Relation |
What will be the output of the following function?
include <stdio.h>
void main() { int a[5] = {5,1,15,20,25}; int i,j,m; i = ++a[1]; j = a[1]++; m = a[i++]; printf(“%d %d %d”,i,j,m); }
What will be the output of the following function?
main() { printf(“RamanDeep”); }
(I) In C, all the function except main() can be called recursively. (II) If return type for a function is not specified, its default is int. (III) A function cannot be defined inside another function. Which of the above statements are true?
Which of the following statement correctly obtains the remainder on dividing 5.5 by 1.3?
Which of the following is incorrect? A recursive function
Switch cannot have a ______ type value?
(A) If malloc() successfully allocates memory then returns the number of bytes it has allocated. (B) malloc() returns a float pointer if memory is allocated for storing float. (C) malloc() returns a NULL if it fails to allocate request memory. Which of the above statements are true?
What will be the output of the following function?
define DIM1(array,type) sizeof(array)/sizeof(type)
int DIM2(int array[]) { return(sizeof(array)/sizeof(int)); } void main() { int arr[10]; printf(“%d %d “, DIM1(arr,int), DIM2(arr)); }
Pick the odd one out.
What will be the output of the following function?
include <stdio.h>
void main() { int i =2,j=2; printf(“%d %d %d %d”,i,i++,j,++j); }
What will be the output of the following question?
main() { extern int out; printf(“%d”,out); } int out=100;
Match the following ||| |---|---| | (1) local variables | (a) stack | | (2) global variable | (b) register | | (3) register variable | (c) main memory | | (4) Static variable | (d) data memory |
What will be the output of the following question?
fun()
{
here:
printf(“pp”);
}
main()
{
int i=1;
while(i<=5)
{
printf(“%d”,i);
if(i>2)
goto here;
i++;
}
}
What will be the output of the following function?
main() { int a[10]; printf(%d,*a+1-*a+3); }
What will be the output of the following function?
include <stdio.h>
void main() { char str[10] = “Angel”; str[6] ='d'; printf(“%s”,str); }
(I) Every time we supply new set of values at command prompt, we need to recompile the program. (II) Even if integer/float arguments are supplied at command prompt, they are treated as strings. (III) The first argument to be supplied at command-line must always be the count of total argument.
Which of the above statement/s is/are true about command line argument?
What will be the output of the following function?
main()
{
int i;
printf(%d,scanf(%d,&i));
// value 10 is given as input here
}
What will be the output of the following function?
main() { printf(%x,-1<<4); }
Choose the correct option among the following.
What will be the output of the following function?
main() { char *p; printf(%d %d ,sizeof(*p),sizeof(p)); }
What will be the output of the following function?
#define square(x) x*x
main()
{
int i;
i = 64/square(4);
printf(%d,i);
}
What will be the output of the following function?
main() { static int var = 5; printf(%d ,var--); if(var) main(); }
What will be the output of the following function?
#define int char main() { int i=65; printf(%d,sizeof(i)); }
What will be the output of the following function?
#include<stdio.h> main() { struct xx { int x=3; char name[]=hello; }; struct xx *s; printf(%d,s->x); printf(%s,s->name); }
(a) Associativity of “COMMA” is L à R. (b) Associativity of printf function is R à L. Which of the above is/are TRUE?
Given the piece of code int a[50]; int *pa; pa = a; to access the 6th element, which of the following is incorrect?
What will be the output of the following function?
#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts(NULL); else if(FALSE) puts(TRUE); else puts(FALSE); }
What will be the output of the following function?
main() { int i=0; for(i=0;i<20;i++) { switch(i){ case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf(%d,,i); } }
What will be the output of the following function?
include <stdio.h>
void main() { int k,num=30; k = (num>5 ? (num <=10 ? 100:200) :500); printf(“%d”,num); }
What will be the output of the following function?
include<stdio.h>
void fun(int *f) { *f = 10; } void main() { const int arr[5] = {1,2,3,4,5}; fun(&arr[3]); printf(“%d”,arr[3]); }