Computer Science MCQs · C Programming What happens when a C program executes char *s = "hello"; s[0] = 'H';? A Undefined behaviour, because the literal is read-only Correct answer B The literal is modified and prints "Hello" C A copy on the heap is modified instead D The compiler automatically allocates writable memory for the literal MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming What does strcmp("apple", "apricot") return in C? A The number of differing characters in the strings B A negative value, because "apple" sorts first Correct answer C Zero, because the strings are different D A positive value, because "apple" is longer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming In the declaration const char *p, what exactly is const? A Both the pointer and the characters are fixed B Nothing, since const is ignored on pointers C The pointed-to characters cannot be modified Correct answer D The pointer p cannot be reassigned MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming In C, what does the logical AND operator do when its left operand is false? A It raises a runtime fault on the expression B It skips evaluating the right operand Correct answer C It evaluates both operands and compares them D It falls back to a bitwise AND on the bits MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming With int a[4] = {10, 20, 30, 40}; int *p = a; what does printf("%d", *(p + 2)); print? A 20, the array's second element B 10, the element at the base address C The address of the third element itself D 30, the third element of the array Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming What does the line #define MAX 100 do in a C program? A Allocates 100 bytes of static storage B Creates a function named MAX returning 100 C Performs textual substitution before compilation Correct answer D Declares a constant integer variable at run time MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which statement immediately terminates the innermost enclosing loop or switch in C? A continue, which jumps ahead to the next iteration of the loop B return, which leaves the whole function C goto, which jumps to a labelled statement D break, which transfers control after the construct Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming For int a[5] = {1, 2}; what value does a[4] hold in C? A Garbage values from the previous stack contents B 2, because the last value is repeated C 1, because the initialiser wraps around D 0, because the remaining elements are zeroed Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which printf conversion specifier correctly prints a double variable in C? A %c B %s C %f Correct answer D %d MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming If p is a pointer to a struct record with a member named age, which expression reads that member? A p.age, which selects from the pointer itself B *p.age, which binds the dot first C &p.age, which takes the member address D p->age, which dereferences and selects Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming After char c = 'A'; c = c + 2; what character does c hold in the ASCII character set? A 'D', because the second letter position is skipped B 'C', because letters have consecutive codes Correct answer C 65, because the value stays numeric D 'B', because incrementing adds one MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming What does strlen("hello") return in C? A 5, the characters before the terminating null byte Correct answer B 6, counting the terminating null byte as well C 4, because the first character is not counted at all D It is undefined for a string literal argument MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which C loop structure always executes its body at least once, even when the controlling condition is false on entry? A The switch statement, which selects a case label B The do-while loop, which tests after the body Correct answer C The while loop, which tests before the body D The for loop, which tests before the body MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming Which standard C header must be included to use malloc(), calloc() and free()? A <math.h> B <stdlib.h> Correct answer C <stdio.h> D <string.h> MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming What is printed by printf("%d", 7 / 2); in C when both operands are of type int? A 3.5, because floating division keeps the fraction B 4, because the result is rounded to nearest C 2, because the result is rounded downward D 3, because integer division truncates toward zero Correct answer MCQSEXAM Show answer Read explanation
Computer Science MCQs · C Programming In C, what does the expression sizeof(a) / sizeof(a[0]) evaluate to when a is declared as int a[5]; on a machine where int is 4 bytes? A 1, because the two operands cancel out B 5, the number of elements in the array Correct answer C 20, the total size of the array in bytes D 4, the size of one integer element MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What does elasticity mean in cloud provisioning? A Storing exactly one copy of each object B Acquiring and releasing resources automatically Correct answer C Keeping a fixed pool of reserved servers D Moving workloads to cheaper regions MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What does eventual consistency guarantee for a replicated store? A Replicas converge once writes stop Correct answer B Reads always see the newest write C Writes are refused during a partition D Every replica holds a separate schema MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing How do containers differ from virtual machines? A Containers cannot be isolated at all B Containers share the host kernel Correct answer C Containers each boot a full guest OS D Containers need a hypervisor to run MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What does a cloud service level agreement normally state? A The maximum number of tenants B Guaranteed uptime and service credits Correct answer C The platform's full source code D The exact hardware in every host MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What is a virtual private cloud used for? A Isolating resources in a private network Correct answer B Publishing an application to the internet C Running virtual machines on local hosts D Replicating a database across regions MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What does a load balancer do with incoming requests? A Encrypts them at the network edge B Spreads them across healthy servers Correct answer C Compresses them before storage D Assigns them to one fixed server MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing During a network partition, what must a distributed system trade away under CAP? A Nothing, if replicas exist B Consistency or availability Correct answer C Durability or consistency D Latency or throughput MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing What limits vertical scaling of a single server? A The licence count of the software B The number of load balancers used C The largest machine that can be bought Correct answer D The number of network ports used MCQSEXAM Show answer Read explanation
Computer Science MCQs · Cloud Computing How is serverless computing usually charged? A Per reserved virtual machine hour B Per gigabyte of block storage C Per administrator account D Per request and execution duration Correct answer MCQSEXAM Show answer Read explanation