Consider the following C statements:
char *str1 = "Hello; /* Statement S1 */
char *str2 = "Hello;"; /* Statement S2 */
int *str3 = "Hello"; /* Statement S3 */
Which of the following options is/are correct?
Look at what each phase of compilation would catch in these three declarations.
In S1, char *str1 = 'Hello;, the quote that starts the string is never matched by a closing quote before the source line ends. The scanner cannot form a valid STRING token, so this is caught at the lexical analysis stage, a lexical error.
In S2, char *str2 = 'Hello;';, the quotes are balanced: the string constant is 'Hello;', containing the characters H-e-l-l-o-; as its value, followed by the actual statement-terminating semicolon. Both the scanner and the parser accept this line without complaint.
In S3, int *str3 = 'Hello';, tokenization and parsing both succeed since 'Hello' is a well-formed literal. The problem only surfaces when the compiler checks types: a string literal decays to char *, but it is being stored in an int * variable. Pointer types disagree, so this is flagged during semantic analysis, not during scanning or parsing.
Thus S1 fails lexical analysis and S3 fails semantic analysis, matching option C.
Arrange the following data types available in C language according to their size (smallest to largest):
A. signed long int
B. long double
C. unsigned char
D. unsigned int
Choose the correct answer from the options given below:

Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into the I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests an I/O, and also whenever the process returns from an I/O. The number of times the process will enter the ready queue during its lifetime (not counting the time the process enters the ready queue when it is run initially) is _________ (Answer in integer).
What is printed by the following ANSI C program?
#include<stdio.h>
int main(int argc, char argv[])
{
char a = 'P';
char b = 'x';
char c = (a & b) + '';
char d = (a | b) - '-';
char e = (a ^ b) + '+';
printf("%c %c %c\n", c, d, e);
return 0;
}
ASCII encoding for relevant characters is given below
