July 5, 2021 in C and CPP
Given the code segment
1.4 Given the code segment:
char a[] = “abc”, *p;
Which of the following assigns the starting address of the string “abc” to p?
A) p = a;
B) p = &a;
C) p = *a;
D) *p = a;
July 5, 2021 in C and CPP
1.4 Given the code segment:
char a[] = “abc”, *p;
Which of the following assigns the starting address of the string “abc” to p?
A) p = a;
B) p = &a;
C) p = *a;
D) *p = a;
July 5, 2021 in C and CPP
1.3 What will be the output of the following code segment, if the function is called as
larger(10, 20) ?
int larger(int x, int y) {
int max = x;
if (max < y) {
max = y;
return y;
}
else
return x;
printf(“Larger of %d and %d is %d”, x, y, max);
}
A) Program will not compile as the function has two return statements.
B) Program will not compile as no statement is allowed after return statement.
C) Larger of 10 and 20 is 20.
D) No output.
July 5, 2021 in C and CPP
1.2 Which of the following switch statement is not a valid statement to print “RED” if a character
variable ‘color’ has the value ‘R’ or ‘r’?
A) switch (color) { case ‘R’: case ‘r’: printf(“RED”); break; }
B) switch (color) { case ‘R’: printf(“RED”); break;
case ‘r’ : printf(“RED”); break; }
C) switch (toupper(color)) { case ‘R’: printf(“RED”); break; }
D) switch (color) { case ‘R’ || ‘r’ : printf(“RED”); break; }
July 5, 2021 in C and CPP
1.1 Which of the following is a valid octal constant?
A) 32
B) 032
C) 049
D) 0x49
July 5, 2021 in C and CPP
b) Write a ‘C’ function to split the list in several sub-lists depending on the number of digits representing the integers i.e. single digit integers will form a list, double digit numbers will form another list and so on.
July 5, 2021 in C and CPP
a) Define a self referential structure to represent a set of integer numbers in linked list form.
July 5, 2021 in C and CPP
8. Define a suitable data structure to store the information like student name, roll number, enrolment centre and marks of five different subjects. Write a ‘C’ function to insert sufficient data in your data structure and function to print the name of the student and the total obtained marks who have secured highest total marks for each and every
enrolment centre
July 5, 2021 in C and CPP
b) Write a ‘C’ program to accept a date in the format DD/MM/YYYY and add an integer to
get the resultant date.
July 5, 2021 in C and CPP
a) Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display
the word equivalent representation of the given number.
July 5, 2021 in C and CPP
b) Develop a flowchart and then develop ‘C’ program to find the union of two set of
characters, taken as input from the keyboard.